javascript - changing the text of a button in ajax -


i have list confirmation buttons generated dynamically using php.when click button want change "approved".but not doing so?nothing changes though query submitted successfully.any please.here js code snippet:

function appr ($ref) {   var job_id= $ref;   var resp;   var buttons=$('.confirm'); buttons.click(function(){   var $this=$(this);   $this.text=('approved'); });              if (window.xmlhttprequest) {     resp = new xmlhttprequest(); } else if (window.activexobject) {      resp = new activexobject("microsoft.xmlhttp"); } var data = "job_id="+job_id      resp.open("post",        "approve.php",        true);       resp.setrequestheader("content-type", "application/x-www-form-urlencoded");                        resp.send(data);    resp.onreadystatechange = display_data;   function display_data() {    if (resp.readystate == 4) {       if (resp.status == 200) {         document.getelementbyid("mydiv").innerhtml=resp.responsetext;         } else {         alert('request not successful.');       }      }   }  } 

you can that

$this.html("approved"); 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -