Ajax请求,状态200但不进success
为啥? ///<summary>
///Ajax获取分页数据
///currPage => 当前页码
///</summary>
function GetData(currPage){
var where=$("#where").val();
$.ajax({
url:'__URL__/AjaxData',
type:'post',
dataType:'json',
data:'currPage='+currPage+'&pageSize=5'+'&where='+where,
beforeSend:function(){
$("#grid").datagrid("loading");
},
success:function(json){
alert("710");
json=decodeURIComponent(json);
$("#grid").datagrid("loadData",json);
$("#currPage").val(currPage);
$("#pageCount").val(Math.ceil(json.total/10));
$("#grid").datagrid("loaded");
$("#pageStr").html(ShortPageStr(json.total));
ShowPageBar();
},
error:function(data){
var json=decodeURIComponent(data.responseText);
json=eval('('+json+')');
$("#grid").datagrid("loadData",json);
$("#currPage").val(currPage);
$("#pageCount").val(Math.ceil(json.total/5));
$("#grid").datagrid("loaded");
$("#pageStr").html(ShortPageStr(json.total));
ShowPageBar();
}
});
}
为啥? ///<summary>
///Ajax获取分页数据
///currPage => 当前页码
///</summary>
function GetData(currPage){
var where=$("#where").val();
$.ajax({
url:'__URL__/AjaxData',
type:'post',
dataType:'json',
data:'currPage='+currPage+'&pageSize=5'+'&where='+where,
beforeSend:function(){
$("#grid").datagrid("loading");
},
success:function(json){
alert("710");
json=decodeURIComponent(json);
$("#grid").datagrid("loadData",json);
$("#currPage").val(currPage);
$("#pageCount").val(Math.ceil(json.total/10));
$("#grid").datagrid("loaded");
$("#pageStr").html(ShortPageStr(json.total));
ShowPageBar();
},
error:function(data){
var json=decodeURIComponent(data.responseText);
json=eval('('+json+')');
$("#grid").datagrid("loadData",json);
$("#currPage").val(currPage);
$("#pageCount").val(Math.ceil(json.total/5));
$("#grid").datagrid("loaded");
$("#pageStr").html(ShortPageStr(json.total));
ShowPageBar();
}
});
}
解决方案 »
- 关于php dom能不能不用DOMDocument->load 直接读取写在当前php的xml
- 高手帮忙看下,return的问题.
- 关于页面取值问题
- 能不能给个 PHP5 验证码 带实例最好!
- html中用js调用ASP实现静态页面动态显示,搜索引擎是不是搜索不到啊,,在线等啊!!!!!!!!!!!!!
- SESSION参数中的cache_expire和gc_maxlifetime是什么区别?
- 能不能用mail()函数以附件的形式发送邮件?
- 奇怪的问题???请帮忙!!!
- 求教:有没有在win32下会装GD library的?
- 如何用在正则去掉字符串中的\这个字符
- 这种情况应该用什么函数
- 求助:Warning: fopen(RECORD.TXT) [function.fopen]: failed to open stream: Permissio
不过是进入的是error里面
原来是后台用rawurlencode编码
返回的就该是字符串而不是JSON
把dataType:'json'改为dataType:'text',
success里用decodeURIComponent解码
在转成JSON就行了...