求助 jquery ajax error firefox下没问题IE下报错
环境
jquery Ajax
jquery 1.6
1,页面代码:
var postdata = {};
postdata.mode = 'jsonProvince';
$.ajax({
type : "POST",
url : httpUrl,
data: postdata,
cache : false,
dataType :"json",
error : remoteException,
success : function(data, dataType){
alert("88888");
}
});
function remoteException(XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status); // 信息框弹出内容 200
alert(textStatus); // 信息框弹出内容 parsererror
alert(errorThrown); // 信息框弹出内容 IE下: [object Error]
// Chrome下:syntax error unexpected token ILLEGAL
// fireFox下:正常 “88888”对话框能弹出来没问题
}
2,后台代码
$arrSelectedDeliv["error"] = "false";
$arrSelectedDeliv["html"] = "test";
echo jsonEncode($arrSelectedDeliv);
exit;
.....
function jsonEncode($value) {
if (function_exists('json_encode')) {
return json_encode($value);
} else {
require_once dirname(__FILE__) . '/../../module/Services/JSON.php';
GC_Utils_Ex::gfPrintLog(' *use Services_JSON::encode(). faster than using the json_encode!');
$objJson = new Services_JSON();
return $objJson->encode($value);
}
}