bladez Posted October 6, 2008 Share Posted October 6, 2008 Here is the partial codes k... the ajax code & the relating javascript.. <script type="text/javascript"> var http = false; if (typeof XMLHttpRequest != "undefined") { http = new XMLHttpRequest(); } else if (typeof ActiveXObject != "undefined") { http = new ActiveXObject("Microsoft.XMLHTTP"); } else { throw new Error("XMLHttpRequest not supported"); } function approval_param(obj) { var poststr = "eventid=" + encodeURI( document.getElementById("eid").value )+ "&comment=" + encodeURI( document.getElementById("comment").value )+ "&clicked="1"; send_approval(poststr); } function send_approval(parameters) { http.abort(); http.open("POST", "ajax_pdf_approval.php", true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", parameters.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange=function() { if(http.readyState == 1){ document.getElementById('approval_comment').innerHTML = "<img src='images/loader.gif' width=16 height=16> Loading..."; } else if(http.readyState == 2){ document.getElementById('approval_comment').innerHTML = "<img src='images/loader.gif' width=16 height=16> Loading..."; } else if(http.readyState == 3){ document.getElementById('approval_comment').innerHTML = "<img src='images/loader.gif' width=16 height=16> Loading..."; } else if(http.readyState == 4) { document.getElementById('approval_comment').innerHTML = http.responseText; setTimeout("display_comment_hide()",5000); } } http.send(parameters); } function display_comment_hide(){ document.getElementById('approval_comment').style.display='none'; } </script> <script language=javascript> function display_comment_area(eid){ document.getElementById('approval_comment').style.display='inline'; document.getElementById('eid').value = eid; } </script> Here is the corresponding body : <div id='approval_comment' style='background-color:#c7c7c7;border:1px dotted black;position:absolute;top:290px;left:250px;width:500px;display:none;'> <form name='appr_form' id='appr_form' method="post" action="javascript:approval_param(document.getElementById('appr_form'));"> <table width=100%> <tr><td align=left> <font size=2>Comment:</font> </td> <td align=right><a href=# onClick=document.getElementById('approval_comment').style.display='none';>X</a></td></tr> <tr><td colspan=2> <textarea name=comment id='comment' style='width:100%;'></textarea> </td></tr> <tr><td align=right colspan=2> <input type=hidden name='eid' id='eid'> <input type=submit name=submit value='Submit Comment'> </td></tr> <tr><td></td></tr> <tr><td colspan=2 bgcolor=#E7E7E7> <b><font size=1><i>**This is irrevesible. Submitting this will cause event to be approved.</i></font></b> </td></tr></table> </form> </div> this is trigger by : <center><a href=# onclick=display_comment_area('$eid')>Yes</a> <a href=# onclick=''>No</a></center> now the question ... why isnt my ajax working.. ?.. huhu .. I am using in php ..so u might see some php codes.. such as $eid ... Link to comment https://forums.phpfreaks.com/topic/127217-solved-ajax-help-needed-i-dunno-wats-wrong-here-help-me-out-pls/ Share on other sites More sharing options...
bladez Posted October 6, 2008 Author Share Posted October 6, 2008 it was jus the ' " ' ... bloody programming.. hahahaha. thanks man .. for at least trying n looking Link to comment https://forums.phpfreaks.com/topic/127217-solved-ajax-help-needed-i-dunno-wats-wrong-here-help-me-out-pls/#findComment-658052 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.