Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-05-2009, 08:17 PM   PM User | #1
rfresh
Regular Coder

 
Join Date: Jun 2007
Location: Los Angeles
Posts: 545
Thanks: 81
Thanked 5 Times in 5 Posts
rfresh is an unknown quantity at this point
Ajax Help

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 Code:
<?php
session_start
();
$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:

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?

(Note I'm electing to return ASCII data from my ajax call which is allowed.)
__________________
RalphF
Business Text Messaging Services
https://www.MobileTextingService.com
rfresh is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:30 AM.


Advertisement
Log in to turn off these ads.