JS with IE problem

Only with IE the function where if (data == “00:00”) {//this code} not work. why ? :sick:

I add + Math.random() and cache: false but still nothing ((( Do not refresh the pages.

Any ideas ?

function InfoTime() {
    var stat = ['table_for_timer'];
    var url = 'keno_script.php?'+ Math.random();
    $.each(stat, function (i, key) {
        $.post(url, {
            cache: false, stats: key
        }, function (data) {
            if (data == "00:00") {
                $.ajax({
                    url: 'keno_balls.php?'+ Math.random(),
                    type: 'GET',
                    cache: false,
                    success: function (data) {
                        $('#table_for_balls').html(data);
                        $('#tickets_table').load('tickets.php?'+ Math.random());
                        return false;
                    }
                });
            }
            $('#' + key).html(data);
        });
    });
}
setInterval(InfoTime, 1000);

Thanks for help

Two things I would do: trim the data value to make sure there are no whitespaces; and use === instead of == for conditionals.

Try those, and let us know if it helped any. :slight_smile:

I treid but nothing, IE Still not work. :frowning:

change this

$('#table_for_balls').html(data);

to

$('#table_for_balls').html($.trim(data));

and this

if (data == "00:00")

to this

if (data === "00:00")

Hmm… try alert(data) instead, so you can see what’s being returned. (I actually should have suggested that, first.) It’s possible the php file may be returning something else, like an error message.

Now I’m in the wrong, once worked on the IE and at the same time does not work in chrome http://kenogameplay.com here is example, when time 00:00 the balls needed refreshed.

What is being returned when you alert(data)?

In IE nothing return ((( , in Chrome or Opera return all code from keno_balls.php )))

I thing i will do like this, if quest come from IE, show message like (This website can work only with Chrome/Opera/FireFox and other…). I don’t see other version to do IE work with my JS.

Have you tried using IE Web Developer Tools (F12) while attempting this? The error console might give an indication. What version of IE are you using?

Yes i tried, with console.log. But nothing, just update me the time runing. Maybe i do something not good, but i don’t find any error logs, just nothing. And i use last version, IE 11.0.9600.17207

I think this might be part of the problem. In data you are looking for “00:00”, but you said that in Chrome and Opera it returns all code from keno_balls.php. What is that data?

As far as IE is concerned, if keno_balls.php isn’t returning anything, then maybe there’s an issue with processing in the .php file.

GET is supposed to cache the results from the first call for reuse in subsequent calls for the same data.

Have you tried using POST instead - that assumes that the data may have changed even though the request is the same.

Thanks for all WolfShade and felgall.

I tried with POST instead and it WORK! :):):):rofl: