admin管理员组文章数量:1405601
I've got a little .ajax function which trying to load some content after document is ready.
$(document).ready(function(){
$.ajax({
url: 'php/accounts-blocks.php',
cache: false,
beforeSend: function() { $('#accounts-blocks').html('Please wait...'); },
success: function(html) { $('#accounts-blocks').html(html); }
});
});
However, when I'm trying to test this page locally (just on my PC), ajax shows up only "Please wait" message like forever, and doesn't load any content. Should I install local hosting or something like that in order to test AJAX functionality, or is it something wrong with script?
I've got a little .ajax function which trying to load some content after document is ready.
$(document).ready(function(){
$.ajax({
url: 'php/accounts-blocks.php',
cache: false,
beforeSend: function() { $('#accounts-blocks').html('Please wait...'); },
success: function(html) { $('#accounts-blocks').html(html); }
});
});
However, when I'm trying to test this page locally (just on my PC), ajax shows up only "Please wait" message like forever, and doesn't load any content. Should I install local hosting or something like that in order to test AJAX functionality, or is it something wrong with script?
Share Improve this question edited Jun 12, 2014 at 8:37 MrCode 64.6k10 gold badges92 silver badges113 bronze badges asked Apr 14, 2014 at 9:48 DazvoltDazvolt 6972 gold badges10 silver badges22 bronze badges 1- What does the developper toolbar shows on XHR request? What is the status of the request? – D4V1D Commented Apr 14, 2014 at 9:50
1 Answer
Reset to default 6Ajax (XHR) will not work in some browsers (there are exceptions such as Firefox) when running the script locally without having a local web server installed. Chrome is an example that will not allow it.
Use a browser with less strict security, or install a local HTTP server.
本文标签: javascriptJquery ajax() local testingStack Overflow
版权声明:本文标题:javascript - Jquery .ajax() local testing - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744301990a2599626.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论