CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009

    Ajax Help with returning value

    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_return_status "test"
    My form ajax code in the JS section:
    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?
    Last edited by PeejAvery; February 15th, 2009 at 08:26 PM. Reason: Added code tags.

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002

    Re: Ajax Help with returning value

    Well, there is absolutely nothing wrong with the code you have posted.

    If Firefox's Error Console is detecting it, that means it is a client-side error which means that pointing to the word "test" makes no sense.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Oct 2008

    Re: Ajax Help with returning value

    Every website I go to gives FireFox's console errors. So I doubt anything is wrong with your code.
    Plus it all looks valid.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.