View Full Version : Ajax Help

02-05-2009, 09:17 PM
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 (can't get much simpler than this):

$php_return_status = "test";
echo $php_return_status;

My form ajax code in the JS section which also can't get much simpler than this:

function ajax_test_click()
http.open('get', 'Server.php', true);
http.onreadystatechange = returnAjaxData;
function returnAjaxData()
if (http.readyState == 4)
if (http.status == 200)
var response = http.responseText;
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?

(Note I'm electing to return ASCII data from my ajax call which is allowed.)