php/ajax browser problem
This could be considered a browser prob开发者_Go百科lem. It works in firefox, but not IE or Chrome:
http://robotslacker.com/test.php
the php file it's posting to is simply outputting a number. If you load it in Chrome it loads at 99.
So the question is, how can i achieve the same affect on chrome/ie
This works (in my version of Chrome)...but hangs up the browser for quite a while.
function doStuff() {
$.ajax({
type: 'POST',
url: '/ajax_html_echo/',
data: {
i:i
},
success: function(resp) {
$("p").html(i);
},
dataType: "html",
async:false
});
}
var i = 0, timerId = setInterval(function() {
doStuff();
if(++i == 10) clearInterval(timerId);
}, 100);
If you do the test in chrome, you'll notice that it pauses for a while before the 99 is displayed. Most likely it is working properly, it is just NOT displaying the intermediate 1-98 until the POST loop is done. This is on v5.0.375.125 (latest/greatest to date).
If you run the test in opera, it only outputs odd numbers.
精彩评论