我使用 $.ajax 将数据发送到 Sql,当我在查询字符串中传递参数时,我在数据值中得到 null,
function refreshTime(options) {
$.ajaxService({
url: 'http://localhost:1549/Store/Pages/services.aspx?servicename=change,
data: { oldpassword: $("#oldpassword").val(), newpassword: $("#newpassword").val() },
onStartService: function () { $(".failed-message,.success-message").hide(); $("#submitchangepassword,#oldpassword,#newpassword,#confirmpassword").attr('disabled', 'disabled'); },
onEndService: function () { $("#submitchangepassword,#oldpassword,#newpassword,#confirmpassword").removeAttr('disabled').not("#submitchangepassword").val(""); },
onResponse: function (response) {
if (response.result == '1') {
$.pushMessage({ message: 'success', messageClass: 'success-message', delay: 6000 });
}
else {
$.pushMessage({ message:'error ', messageClass: 'failed-message', delay: 8000 });
}
}
});
}
我在服务页面中得到空数据,
但是当我不传递参数时,我得到正确的数据值,
function refreshTime(options) {
$.ajaxService({
url: 'http://localhost:1549/Store/Pages/services.aspx,
data: { oldpassword: $("#oldpassword").val(), newpassword: $("#newpassword").val() },
onStartService: function () { $(".failed-message,.success-message").hide(); $("#submitchangepassword,#oldpassword,#newpassword,#confirmpassword").attr('disabled', 'disabled'); },
onEndService: function () { $("#submitchangepassword,#oldpassword,#newpassword,#confirmpassword").removeAttr('disabled').not("#submitchangepassword").val(""); },
onResponse: function (response) {
if (response.result == '1') {
$.pushMessage({ message: 'success', messageClass: 'success-message', delay: 6000 });
}
else {
$.pushMessage({ message:'error ', messageClass: 'failed-message', delay: 8000 });
}
}
});
}
在这种情况下,我没有得到空数据,
是什么原因?