asp.net - Cross domain call not working in FireFox and Chrome -
i making asynchronous request different server data using jquery. works fine in ie, doesn't work in firefox , chrome, when reaches code request other server made, freezes there , blank page shown. if remove piece of code, ajax works fine.
also, when place breakpoint @ document.ready, breakpoint hit when debugging using ie, it's not hit when debugging using firefox.
following jquery using
jquery(document).ready(function ($) { $('.tabs a, .tabs span').livequery('click', function () { var currenttab = $(this).parents('li:first'); if (!currenttab.is('.active')) { var currentcontent = $('.tab_container .' + currenttab.attr('class')); $('.tabs li').removeclass("active"); currenttab.addclass("active"); var url = $(this).attr("href"); var newcontent = ""; if (currentcontent.length == 0) { $.get(url, {}, function (result) { $('#tabs.tab_container div:visible').fadeout(100, function () { $('#tabs.tab_container') .html(result) .fadein(100); }); }, 'html'); } else { $('#tabs.tab_container div:visible').fadeout(100, function () { currentcontent.fadein(100); }); } } return false; }); });
any highly appreciated.
according docs jquery.get:
due browser security restrictions, "ajax" requests subject same origin policy; request can not retrieve data different domain, subdomain, or protocol.
if you're after json responses, should consider using jsonp option has been rolled getjson method.
there couple of people out there have provided workarounds limitation:
Comments
Post a Comment