Jump to content

[SOLVED] ajax help needed.. i dunno wats wrong here.. help me out pls.


bladez

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.