I cannot echo two variables when sent to the server with xmlHttp.open. I understand that I need to use & to seperate the variables, but I am getting a server response error and no output. The code works fine if just the foo variable is sent. I think it must be a simple error I just need another set of eyes on.
Javascript File:
var foo = "foo"
var bar = "bar"
xmlHttp.open("GET", "update.php?foo=" + foo+ "&bar=" + bar, true);
xmlHttp.onreadystatechange = handleServerResponse;
xmlHttp.send(null);
update.php:
<?php
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
echo '<response>';
$foo= $_GET['foo'];
$bar= $_GET['bar'];
echo 'Variable foo: ' . $foo. ' Variable bar ' . $bar; // Server response error and no output
echo '</response>';
?>
No comments:
Post a Comment