I'm working on a script to load some images async using jQuery.
Here is a code snippet of the function that loads the images -
try{
for(img in imgsArray){
$.ajax({
async: false,
type: "get",
url:imgsArray[img],
success:function(imgFile){
alert("success");
//do something useful
},
error:function(XMLHttpRequest,status,error){
//do nothing
}
});//ajax
}
}
catch(e){
//oops
}
I have tested this in Firefox, Webkit (Safari,Chrome) and it works.
The images are in a folder on the server and I'm using jQuery 1.3.
any ideas?
ajax post method. The reason was my response was not in the JSON format so there was no need for the dataType: 'json' line in the submit method. In my case, the returned response was in text format that's why it was not going to success event. Solution: Remove dataType: 'json' line.
Whenever an Ajax request completes successfully, jQuery triggers the ajaxSuccess event. Any and all handlers that have been registered with the . ajaxSuccess() method are executed at this time. $( ".
ajax function is deprecated.
A simple fix of this problem is to provide the jQuery setting dataType : 'text'
or dataType : 'xml'
or dataType : 'json'
or any other available response type.
I had same problem, but it's working fine after specifying the dataType setting in the .ajax call.
IE is really not an intelligent browser, it doesn't assume the default value string.
Try it... good luck.
Try setting the cached-option to false.
$.ajax({
async: false,
cache: false,
type: "get",
url:imgsArray[img],
success:function(imgFile){
alert("success");
//do something useful
},
error:function(XMLHttpRequest,status,error){
//do nothing
}
});//ajax
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With