随笔 - 17,  文章 - 0,  评论 - 0
 //jqGrid去除某个单元格样式class
$("td[aria-describedby='GridTableName_indexName']","#GridTableName").eq(i).removeClass("className");

//jqGrid 在某个单元格添加按钮 
var ButtonNameHtml = '<input id="'+ids[i]+'_ButtonName" type=\"button\">';
$("#GridTableName").setCell(ids[i], "ButtonName", ButtonNameHtml);
$("#GridTableName").getCell(id, "indexName");
//获取ids
var ids = $("#GridTableName").getDataIDs();
//jqGrid 按钮的点击事件
$("#"+ids[i]+"_ButtonName").click(function(){});
//与Action交换数据
$.post("ActionName",{jsonParameter},returnFunction);
//eg:
//  1.
$.post("login!login.action",{userName:"wp",pasword:"123"},function(data,status){});
//  2.
var user = new Object();
user.userName = $('#userName').val();
user.password = $('#password').val();
user.userType = $('input[name="userType"]:checked').val();
var postString = $toJSON(user);
var postData = "[" +postData +"]";
$.post("login!login.action",{send:postData},returnFunction(data,status));
var returnFunction = function(data,status){
  //打印List型的messae  
  if(data.message.length != 0){
    //清空显示message的div
    $('#errorArea').empty();
     $.each(data.message,function(key,val){
      //一次打印出所有message
      $('#errorArea').append("<p>"+val+"</p>");  
      }) 
    } else {
      //如果length = 0 说明没有任何错误message,登录成功
      //coding here .....
    }
//如果post失败,比如无法找到login.action就执行error()
}.error(function(){$('#errorArea').append("<p>error happened</p>");})

 

posted on 2013-08-30 10:21  new PersonBean()  阅读(127)  评论(0编辑  收藏