dave dave - 1 year ago 158
Smarty Question

ajax request is not sending on ie11

i have spent all day on this, reading and reading and trying different things and i still cannot get the ajax request to send in ie11. So i have pretty much stipped this down to nothing and as you an see i have cache set to false and also added a random number on the end of the url in order to not be cached by ie. FF and Chrome work fine... i have a file_put_contents set up ine the php file for the request and i get the array in that file with both FF and chrome when i run this code, but IE there is nothing... help please.. thanks :)

<script type="text/javascript">

/* yes the literals are backwords thats how it works */
/* for smarty in js - see smarty forum */
/* addEventListener is ok we do not support < ie9 */

"use strict";

var r = '?ran='+Math.floor((Math.random() * 10000) +1);
var ajaxurl = {/literal} '{$ajaxUrl}'{literal};
var roomid = {/literal} '{$room}' {literal};
var userid = {/literal} '{$userid}' {literal};
var urlwithr = ajaxurl+r;

window.addEventListener('unload', function(event) {

cache: false,
method: 'GET',
url: urlwithr,
data: {
roomid: roomid,
userid: userid,
urlwr: urlwithr,
ajax: true
success: function() {
/* nothing dont need it */

Answer Source

Thanks to eisbehr for this answer... kudos :) here is what worked, the rest of the code is the same. What is ironic is that this is pretty much what i started with and i have gone all the way around the block from tons of code to back to this. I started using unload in the early stages because i did not like the fact that beforeunload had a alert and what if they said no to the alert. But now it seems to be working fine with no alert, and all of this just because of the word 'event' lol

window.addEventListener('beforeunload', function() {

thanks again eisbehr...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download