0

I have a simple ajax request function and theres some syntax error im missing. Just need a second pair of eyes.. thanks

    function GetPaginationPage(array) {
        $.ajax({
            type: "POST",
            url: "includes/get_pagination_page.php",
            data: array,
            success: function(data){ function (data) {
            $('.contestants_list').append(data);
        }};
            });
    };
3
  • try to use Object instead of Array Commented Jul 12, 2012 at 14:52
  • You have two extra semicolons. One causes a syntax error, the other doesn't. Use JSLint within JSFiddle or JSLint directly. You also have an extra function(data){...} Commented Jul 12, 2012 at 14:53
  • 2
    You have nested anonymous functions in your success callback, that doesn't look right. Commented Jul 12, 2012 at 14:54

3 Answers 3

2

Try this

function GetPaginationPage(array) {
    $.ajax({
        type: "POST",
        url: "includes/get_pagination_page.php",
        data: array,
        success: function(data) {$('.contestants_list').append(data);}
    });
};
Sign up to request clarification or add additional context in comments.

Comments

1

The problem would be that you're rewrapped the function of the success envent, also you add a semicolon at the end of the function

Do remove the two function in the success event and the semicolon at the end, should look like this

$.ajax({
   type: "POST",
   url: "includes/get_pagination_page.php",
   data: array,
   success: function(data) {
     $('.contestants_list').append(data);
   }
});​

Notes

A tip when you have this troubles uses http://jsfiddle.net/ and test your javascript code uising the button JsLint to check for errors

Comments

0

You have function(data) twice for some reason, change it to this instead:

function GetPaginationPage(array) {
        $.ajax({
            type: "POST",
            url: "includes/get_pagination_page.php",
            data: array,
            success: function(data){ 
                $('.contestants_list').append(data);
            }
        });
};

Hope this helps

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.