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+"'}",
 
posted @ 2016-10-10 10:02  esther-qing  阅读(33570)  评论(0编辑  收藏  举报