#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Adelaide, South Australia
    Posts
    15
    Rep Power
    0

    AJAX/JavaScript Coding Error


    Hey Guys,

    I've got this bit of javascript that's not working. Dreamweaver is telling me there's a code syntax error on the line that starts with "url:" - I really don't know what I'm doing with javascript, just wondering whether anyone might have an idea what the problem is on that line?


    Code:
    <script type="text/javascript">
        function ajaxfunction(parent)
        {
            $.ajax({
                url: 'article_category_process.php?parent=' + parent ;
                success: function(data) {
                    $("#sub").html(data);
                }
            });
        }
    </script>

    Thanks in advance.

    Ben
  2. #2
  3. Jealous Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,303
    Rep Power
    9400
    Semicolons are only for terminating statements. That line is not a statement.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Adelaide, South Australia
    Posts
    15
    Rep Power
    0
    Originally Posted by requinix
    Semicolons are only for terminating statements. That line is not a statement.
    When I remove the semicolon the error drops to the next line lol
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Originally Posted by ben.y
    When I remove the semicolon the error drops to the next line lol
    You need to replace the semicolon with a comma, not delete it. Because that's the syntax of object literals:
    Code:
    {
    	property1: value1,
    	property2: value2,
    	...
    }

IMN logo majestic logo threadwatch logo seochat tools logo