post不需要给key-value形式:

$("#btn").click(function(){
var url=basePath+"/emp/login";
var loginName=$("#loginName").val();
var pwd=$("#spe").val();
var param={"loginName":loginName,"empPwd":pwd}; $.post(url,param,function(data){
alert(data.result+" "+data.reason);
})
});

ajax需要给key-value形式:

$(function() {
$("#btn").click(function() {
var $name = $("#username").val();
var $pwd = $("#password").val();
$.ajax({
url : $("#basePath").attr("href") + "/emp/0904login",
data : {
"name" : $name,
"pwd" : $pwd
},
method : "post",
dataType : "json",
success : function(index) {
if (index.result == "true") {
alert("登陆成功!");
} else {
alert(index.reason);
}
}
});
})
});

随机推荐

  1. js中两个感叹号的原理与用法分析(转载记录没找到原帖)

    var foo; alert(!foo);//undifined情况下,一个感叹号返回的是true; alert(!goo);//null情况下,一个感叹号返回的也是true; var o={flag ...

  2. 5.编写Java应用程序。首先,定义描述学生的类——Student,包括学号(int)、 姓名(String)、年龄(int)等属性;二个方法:Student(int stuNo,String name,int age) 用于对对象的初始化,outPut()用于输出学生信息。其次,再定义一个主类—— TestClass,在主类的main方法中创建多个Student类的对象,使用这些对象来测 试St

    Student类: package com.bao; public class Student { int stuNo;String name,sex;int age,weight; Student( ...

  3. 将json文件转换为字符串

    //从给定位置读取Json文件    public   String readJson(String path){        //从给定位置获取文件        File file = new ...

  4. BJFU 1397 致我们终将逝去的爱情

      LIS 由于要记录轨迹,所以不能用O(nlogn)优化,直接dp加father记录每个节点的转移. #include<cstdio> #include<algorithm> ...

  5. java操作cookies

    建立一个无生命周期的cookie,即随着浏览器的关闭即消失的cookie,代码如下 HttpServletRequest request HttpServletResponse response Co ...

  6. hdu_Anniversary party_(树形DP入门题)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1520 题意:有N个人,N-1个人有自己的上司,每个人有一个快乐值,如果这个人参加了聚会,那么这个人的直 ...

  7. diff and patch

    A patch captures the changes of two different files (oldfile and newfile). Given the oldfile and the ...

  8. 【我与一道水题的抗争之路】 哈理工2323 Emirp(反素数)

    题目: http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=2323 1,打表的姿势不对. ...

  9. Linux 系统监控

    *lsof 列出打开的文件 常用   lsof -i:8080*htop进程监控iotop(bugs)iptraf实时局域网IP监控psacct 监视用户活动monit Linux进程和服务监控工具* ...

  10. postgres-xl 集体搭建(1)

    安装并编辑脚本 cd /opt/curl -O http://files.postgres-xl.org/postgres-xl95r1beta1.tar.gztar -zxvf postgres-x ...