Hello all,
I am having problems passing parameters to a PHP script using xmlhttp.open().
Here is the javascript code:
[CODE]
<script>
function cancel_jobs() {
if (! confirm(“Are you sure you want to cancel your job(s)?”))
{ return; }
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
alert( this.responseText);
}
};
xmlhttp.open(“GET”, “test.php?param1¶m2¶m3”, true);
xmlhttp.send();
}
</script>
Here is the code in test.php
[CODE]<?php
$param_array = $_SERVER[‘argv’];
$php_file = $param_array[0];
$param1 = $param_array[1];
$param2 = $param_array[2];
$param3 = $param_array[3];
echo “php file: $php_filen”;
echo “param1: $param1n”;
echo “param2: $param2n”;
echo “param3: $param3n”;
?>
I am also getting a PHP Notice in the error_log file.
[CODE] PHP Notice: Undefined index: argv in /var/www/html/test.php on line 3
I also tried the following with the same results:
[CODE] xmlhttp.open(“GET”, “test.php param1 param2 param3”, true);
Any help would be greatly appreciated.
Thanks in advance.