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();
}
});
}
解决方案 »
- LKOAAspcn.dll求助
- 关于 PHP PEAR Structure datagrid的问题
- 页面刷新到底执行了什么
- ecshop
- 如何从一段字符中取出我的我想要的部分
- 织梦模版 导航栏添加了一个顶级栏目 怎么让他直接打开 那个顶级栏目的一个子栏目?
- 如何实现像CSDN BLOG上面发布文章那种类似WORD编辑工具的效果
- php从a循环到z怎么编写呢?
- 兄弟们,救救我呀!关于php邮件发送问题 50分相送
- 请问哪里有关于php3的中文书籍,比较好的!!!
- 这种情况应该用什么函数
- 求助:Warning: fopen(RECORD.TXT) [function.fopen]: failed to open stream: Permissio
不过是进入的是error里面
原来是后台用rawurlencode编码
返回的就该是字符串而不是JSON
把dataType:'json'改为dataType:'text',
success里用decodeURIComponent解码
在转成JSON就行了...