Convert Javascript into jQuery ajax? -
i new in jquery , having trouble in converting javascript jquery ajax tried did not if can me shall thankful him/her.
how code works:
when click on edit button popup displayed showing record of person , can edit in popup , save it.
how looks like:
this javascript ajax code:
function update(str) { if (str=="") { document.getelementbyid("txthint").innerhtml=""; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("dialog").innerhtml=xmlhttp.responsetext; $( "#dialog" ).dialog(); } } xmlhttp.open("get","updateattendence.php?q="+str,true); xmlhttp.send(); }
here html code:
<div id="dialog" title="edit"> <div id="txthint"></div> </div>
problem: have tried jquery method can don't know how call javascript function. , showing nothing.
using jquery $.get()
be:
function update(str) { if (str=="") { $("#txthint").html(""); return; } $.get('updateattendence.php', { q : str }, function(response){ $('#dialog') .html(response) .dialog(); }); }
Comments
Post a Comment