jquery-issue with load(): works with Firefox and Safari, not with Chrome, Opera and IE

StackOverflow https://stackoverflow.com/questions/23328302

سؤال

May somebody could take a look at this. With Firefox and Safari it works, but not with Chrome, IE and Oopera... and I don't know why.

After a click in a table, it fetches the id and will build a url which will be loaded. Actually I will pass arrays with load to the php, but for the demonstration, I guess this example makes more sense:

var id1 = "1";
var id2 = "2";

oTable.$('tr').click(function () {
    isClicked = $(this).data('clicked');
    if (isClicked) {
        isClicked = false;
    } else {
        isClicked = true;
    }
    $(this).data('clicked', isClicked);

    if (isClicked) {
        id2 = id1;
        id1 = oTable.fnGetData(this, 0);
        $(window).scrollTo('#ma', {
            duration: 1000
        });
        $("#ma").fadeOut('slow', function () {
            $("#ma").fadeIn('slow').load("index" + id1 + id2 + ".html");
        });
    } else {
        id2 = id1;
        id1 = oTable.fnGetData(this, 0);
        $(window).scrollTo('#ma', {
            duration: 1000
        });
        $("#ma").fadeOut('slow', function () {
            $("#ma").fadeIn('slow').load("index" + id1 + id2 + ".html");
        });
    }
}); 

What happens in all browsers: After a click in a row it will scroll to the id #ma (so the functions work in a toggle way), but only Firefox and Safari will load the file.

What's wrong with it? Or is it an issue with the ids in the url, and will be okay, when I push it as arrays to the php? So far I tried it only in local modus.

هل كانت مفيدة؟

المحلول

adeneo gave the hint: The script is fine, but I "can't make ajax requests from a file:: protocol". I tried to load the file from a local folder. Obviously the 3 browsers don't like it... and Firefox and Safari just ignore it.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top