Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Ajax Error Help

  1. #1
    New to the CF scene
    Join Date
    Mar 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Ajax Error Help

    I have just started learning about Ajax today and was working through some examples online. I have come across a very simple one that I just can't get to work

    The tutorial I have copied the code from.

    When I choose from the drop down box nothing happens I get an error icon in the corner. It states:
    Code:
    Line: 9
    Char: 1
    Error: Object Expected
    Code: 0
    The code I used is:
    PHP Code:
    <html>
    <
    head>
    <
    script src="selectuser.js"></script>
    </head>
    <body><form> 
    Select a User:
    <select name="users" onchange="showUser(this.value)"> 
    <option value="1">Peter Griffin</option>
    <option value="2">Lois Griffin</option>
    <option value="3">Glenn Quagmire</option>
    <option value="4">Joseph Swanson</option>
    </select>
    </form><p>
    <div id="txtHint"><b>User info will be listed here.</b></div>
    </p></body>
    </html> 
    If anyone can point me in the right direction, thanks

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Have you saved selectuser.js in the same directory?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Mar 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for your reply, yeah selectuser.js is in the same directory.
    I have also tried copying the contents of selectuser and putting it in the html file but I still get the same error.

    Could it be something to do with the server side of things as I'm using one I've setup and may have missed something trivial

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Well, the firefox's addon firebug is a best friend to find out the cause of such errors. BTW, I use Sajax toolkit, very easy to handle.
    Last edited by abduraooft; 03-10-2008 at 12:42 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Timmymna (03-10-2008)

  • #5
    New to the CF scene
    Join Date
    Mar 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up

    Installed firebug which gave me an error that led me to a couple of websites and solved the problem

    I had to change:
    PHP Code:
    var xmlHttpfunction showUser(str)

    to:
    PHP Code:
    var xmlHttp

    function showUser(str)

    Thanks for the help abduraooft


  •  

    Posting Permissions

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