I'm trying to setup a ajax structure in my HTML form and I'm getting an error "syntax error - line 1" in my AjaxServer.php file. The file has nothing in it yet except a test string to make sure I have all my ajax code working in my form.
PHP script on the Server side:
PHP Code:
<?php
session_start();
$php_return_status = "test";
echo $php_return_status;
?>
My form ajax code in the JS section:
Code:
function ajax_test_click()
{
http.open('get', 'Server.php', true);
http.onreadystatechange = returnAjaxData;
http.send(null);
}
function returnAjaxData()
{
if (http.readyState == 4)
{
if (http.status == 200)
{
var response = http.responseText;
alert(response);
}
else
{
alert("Ajax error: " + http.statusText);
}
}
}
I get the JS dialog box ok which displays "Test" but I'm also getting a Firefox Error Console display of "Syntax error - line 1" and an arrow pointing to the word 'test'.
Does anyone know what might be causing this error?