以一个简单的js为例
RECEIVENOTICE ={
init:function(){
$.ajax({
type:"POST",
url:"getwebpage.do",//action路径
cache:false,
async: false,
dataType:"html",//此处类型为html可根据action的forward返回的数据进行定义
data:{"pagename":"Re_notice"},//传递的参数key-value对
beforeSend: function(XMLHttpRequest){},
success: function(data, textStatus){
$("#workBodyId").html(data);//接受action中request返回的信息
PM.setcallback(LOGINACCOUNT.dosize);
PM.setFuncName("LoginAccountManager");
PM.doresize();},
complete: function(XMLHttpRequest, textStatus){},
error: function(XMLHttpRequest, textStatus, errorThrown){
ERROR.show("LoginAccountManager Exception Connect Administrator");}});return this;},
del:function(id){
var notice_id=id;var jdata = $.parseJSON('{"noticeId":"'+notice_id+'","pagename":"del_notice"}');
$.ajax({
type: "POST",
url: "getwebpage.do",
cache: false,async: false,
dataType: "html",
data: jdata,
beforeSend: function(XMLHttpRequest){},
success: function(data, textStatus){
alert("delete success");$("#workBodyId").html(data);},
complete: function(XMLHttpRequest, textStatus){},
error: function(XMLHttpRequest, textStatus, errorThrown){
//ERROR.show(" Exception Connect Administrator"+textStatus);
//init();
}});},};