jquery uses $.ajax and checkbox to implement the next notification function _jquery

Source: Internet
Author: User

For the XXX platform to implement a feature, use the check box settings on the Announcements pop-up page to no longer notify such announcements.
 
Principle: <input type= "checkbox" id= "Isselect" name= "Isselect" "value=" "onclick=" javascript:notips (); " />,checkbox the form is selected, the Struts2 action Isselect is ' 10 ', and no submit form isselect is null.
 
1.jsp page

 <form id= "Form1" > <div class= "Jf_tanchu" > <div class= "jf_tanchutit" &G t;${bussinessnotice.noticetitle}</div> <div class= "Jf_tanchubox" > <div "class=" & 
    Gt Post type: <v:dcolor code= "${bussinessnotice.noticetype}"/>     release time: <fmt:formatdate value = "${bussinessnotice.createdate}" pattern= "Yyyy-mm-dd"/> </div> ${bussinessnotice.noticeinfo} </d iv> </div> <s:if test= "bussinessnotice.noticetype== ' 25 ' | | bussinessnotice.noticetype== ' 63 ' | | bussinessnotice.noticetype== ' "> <div> <input type=" hidden "name=" Noticetype "value=" ${ Bussinessnotice.noticetype} "/> <input type=" checkbox "id=" Isselect "name=" Isselect "value=" ${ Bussinessnotice.noticetype} "onclick=" Javascript:notips (); /> <label for= "Isselect" > no longer notice such announcements </label> </div> </s:if> </form> 

2.js Code

 function Notips () { 
  var Formparam = $ ("#form1"). Serialize ()//Serialization table content is String 
  $.ajax ({ 
    type: ' Post ',   
    URL : ' Notice_notipsnotice ', 
    Data:formparam, 
    cache:false, 
    dataType: ' json ', 
    success:function (data) { 
    } 
  }); 
} 
 

3.NoticeAction Code

/** * checkbox does not prompt for notice, needs to modify the shielding status in the Tbussinessset, Ajax asynchronous request/public void Notipsnotice () { 
     
    try {printwriter out = This.getresponse (). Getwriter (); 
    Bussinessset = Bussinesssetservice.querybyid (GetUserID ()); 
    String state = ""; 
    if (isselect==null) {//noticetype==null does not check checkbox state = "11"; 
    } else{state = "10"; 
    } if (Noticetype) {bussinessset.setsaleback (state); 
    else if ("Noticetype") {Bussinessset.setremittancebank (state); 
    else if ("Noticetype") {bussinessset.setremittanceonline (state); 
     
    } bussinesssetservice.update (Bussinessset); 
  Out.print (""); 
  catch (Exception e) {log.error (E.fillinstacktrace ()); } 
} 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.