Ajax中传递Json格式的参数



address:http://www.cnblogs.com/esther-qing/p/5944724.html


$.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+"'}",

你可能感兴趣的:(Js)