jquery $.post 设置超时相关问题

心意 2012-10-12 11:40:36
function inquireUkeyStatusFromUrl(url) {
var name = $("#name").val();
$.post(url, {
name:name
}, function (data) {
var msgJson = eval(data);
if (msgJson.status == "0") {
$("#infoRefund").attr("style", 'display:block')
} else {
alert("查询错误,请稍后再试")
}
});
}


使用$.post方法可以设置 超时么?怎么设置呢
...全文
1568 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
$post是$.ajax的一个简化。简化,所以就会省去很多参数。
要用更多功能,就用$.ajax
kongxh1218 2012-10-12
  • 打赏
  • 举报
回复
$.post不能设置超时时间
ld191474639 2012-10-12
  • 打赏
  • 举报
回复
See above note about using $.ajax.
看见了吗,看$.ajax有这个设置时间。$post没有
心意 2012-10-12
  • 打赏
  • 举报
回复
我就想问问$.post 这个有超时设置么 ,我知道他的状态有超时这个状态


function (data, textStatus) {
// data could be xmlDoc, jsonObj, html, text, etc...
this; // the options for this ajax request
// textStatus can be one of:
// "timeout"
// "error"
// "notmodified"
// "success"
// "parsererror"
// NOTE: Apparently, only "success" is returned when you make
// an Ajax call in this way. Other errors silently fail.
// See above note about using $.ajax.
}
kongxh1218 2012-10-12
  • 打赏
  • 举报
回复
$.ajax可以
$.ajax({
url:url,
type:"POST",
data:{name:name},
timeout:30000,
dataType:"json",
success:function(data){
//var msgJson = eval(data); dataType为json,就不用转了
if (msgJson.status == "0") {
$("#infoRefund").attr("style", 'display:block')
} else {
alert("查询错误,请稍后再试")
}
},
error:function(){}
});

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧