以下 Ajax 调用仅在 IE 中失败。我已经尝试将缓存设置为 false 并设置 contentType。该调用总是导致 IE 中的错误函数。
$.ajax({
type:"GET",
cache: false,
url: 'http://where.yahooapis.com/geocode?location='+address+'&flags=J&appid=dj0yJmk9Y1VON011hMQ',
dataType:'jsonp',
success: function(data) {
var quality = parseInt(data.ResultSet.Quality);
if(quality > 50){
var result = data.ResultSet.Results[0];
if(result.line1 == streetString && result.city == cityString && result.statecode == stateString && result.uzip == zipString)
form.submit();
else if(result.line1 == ""){
$(errorElement).html("Could not find street");
$(form).find("input[type='submit']").removeAttr("disabled");
}
else{
var foundAddress = "....Found Address Text...."
addressDialog.dialog({
modal: true,
width:400,
resizable:false,
title: "Confirm Address",
buttons:[
{
text:"Confirm",
click:function(){
street.val(result.line1);
city.val(result.city);
state.val(result.statecode);
zip.val(result.uzip);
form.submit();
}
},
{
text:"Cancel",
click:function(){
addressDialog.dialog("close");
}
}
],
close:function(event,ui){
$(form).find("input[type='submit']").removeAttr("disabled");
}
});
addressDialog.dialog("open");
}
}else{
$(form).find("input[type='submit']").removeAttr("disabled");
$(errorElement).html("Invalid Address");
}
},
error:function(){
alert(jqXHR.status);
alert(textStatus);
alert(errorThrown);
}
});
errorElement 只是一个跨度,我也将错误打印出来。
当我将 dataType 指定为“json”时,警报显示为
0,错误,无传输
当我将其更改为“jsonp”时,警报显示
200,parseerror,错误:jquery1720949182345742317_1351868503283没有被调用