ajax如何传递json格式的参数
1个回答
展开全部
Ajax中传递Json格式的参数
$.ajax({
type: "post",
url: baseUrl+"sys/login",
dataType: "json",
contentType: "application/json;charset=utf-8",
data: JSON.stringify({userName: loginapp.userName,userPassword: loginapp.userPassword}),
或者拼接字符串的形式:
data: "{'userName': '"+loginapp.userName+"','userPassword': '"+loginapp.userPassword+"'}",
$.ajax({
type: "post",
url: baseUrl+"sys/login",
dataType: "json",
contentType: "application/json;charset=utf-8",
data: JSON.stringify({userName: loginapp.userName,userPassword: loginapp.userPassword}),
或者拼接字符串的形式:
data: "{'userName': '"+loginapp.userName+"','userPassword': '"+loginapp.userPassword+"'}",
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询