php and Ajax problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I can not figure out way this is not working can somebody help?
 
<html>
<head>
 <title>Untitled</title>
<script language="JavaScript">
function createRequestObject() {
 
   var req;
 
   if(window.XMLHttpRequest){
      // Firefox, Safari, Opera...
      req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
      // Internet Explorer 5+
      req = new ActiveXObject("Microsoft.XMLHTTP");
   } else {
      // There is an error creating the object,
      // just as an old browser is being used.
      alert('Problem creating the XMLHttpRequest object');
   }
 
   return req;
 
}
 
// Make the XMLHttpRequest object
var http = createRequestObject();
 
function sendRequest(action,arg) {
   // Open PHP script for requests
   http.open('get', 'eventaction.php?takeaction='+action+'&uid='+arg);
   http.onreadystatechange = handleResponse;
   http.send(null);
 
}
 
function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();
 
        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            document.getElementById(update[0]).innerHTML = update[1];
        }
    }
}
</script>
</head>
 
<body>
<?php 
 $event['deleteevent']='<a
href="javascript:sendRequest(delete,32423434234234234324)">Delete this
event</a>';
 
 echo $event['deleteevent'];
?>
</body>
</html>
 
 
 
this  is the 'eventaction.php script yo test if the ajax script works
<?
if($_GET['takeaction']=="delete"){
$uid=$_GET['uid'];
echo $uid;
exit;
}
 

?>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux