jQueryajax请求不会触发并冻结页面
jQuery ajax request doesnt fire and freezes page
我有一个jquery ajax请求的主要问题。似乎冻结了当前页面
我也试过使用*$.pos*t,但它也有同样的作用。我环顾四周,但似乎找不到确切的答案来解释为什么会发生这种情况。
代码:
var sd = $('#start-date'),
ed = $('#end-date'),
n = $('#name'),
o = [],
m = $('#multi').prop('checked');
if ($.trim(n.val()) !== '') {
$('.option').each(function () {
var el = $(this);
if ($.trim(el.val()) !== '') {
o.push(el.val())
}
});
if (o.length > 1) {
alert(1);
$.ajax({
url: "pageurl",
type: "POST",
data: {
name: n,
options: o,
multiple: m,
start: sd,
end: ed
},
dataType: "json",
success: function (data) {
if (data.success !== undefined) {
if (data.success == '1') {
alert('worked');
} else {
displayWarning(data.reason);
}
} else {
displayWarning('We couldn''t process your request at this time. Please try again later');
}
},
error: function () {
displayWarning('We couldn''t process your request at this time. Please try again later');
}
});
} else {
displayWarning('please enter at least 2 options');
}
} else {
displayWarning('Please provide a name for the poll');
}
如有任何帮助,将不胜感激
谢谢
json无效应如下所示:
var sd = $('#start-date').val(),
ed = $('#end-date').val(),
n = $('#name').val(),
o = [],
m = $('#multi').prop('checked');
data: {
"name": n,
"options": o,
"multiple": m,
"start": sd,
"end": ed
}
相关文章:
- 在哪里使用名为“;冻结”;
- ajax请求的顺序总是不同的
- Meteor如何接收HTTP请求
- 有没有一种方法可以防止img get请求使用css或js发生
- 从ajax请求中获取javascript对象
- JSONP请求返回结果,但也触发error_callback
- 在localhost Dev Box上测试JSONP请求的最佳方式
- Ajax请求文档就绪会导致jquery加载缓慢
- MockJax没有在JavaScript应用程序中发送对我AJAX请求的响应
- 正在传递JSONP标头's数据参数到另一个文件中的AJAX请求
- 在openshift node js应用程序中获取请求
- 反应路由器弄乱了请求网址
- For循环冻结Javascript
- AJAX-如何在不冻结浏览器的情况下逐个发出异步请求
- Ajax 请求冻结网页
- 为什么在执行许多ajax请求时浏览器会冻结
- jQueryajax请求不会触发并冻结页面
- jquery中的多个Ajax请求会冻结浏览器
- jQuery 1.9 - Internet Explorer 9 在第一次$ajax请求后冻结
- Ajax请求将冻结我的Javascript代码