jQuery AJAX语法
我试图找到正确的语法以将变量传递给我的JQuery Post。
var id = empid;$.ajax({
type: "POST",
url: "../Webservices/EmployeeService.asmx/GetEmployeeOrders",
data: "{empid: empid}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(result) {
alert(result.d);
}
我不认为数据:价值是正确的。有人让我挺直吗?
谢谢!
回答:
这个怎么样:
var id = empid;$.ajax({
type: "POST",
url: "../Webservices/EmployeeService.asmx/GetEmployeeOrders",
data: "{empid: " + empid + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(result){
alert(result.d);
console.log(result);
}
});
以上是 jQuery AJAX语法 的全部内容, 来源链接: utcz.com/qa/428423.html