Jonah Katz
Jonah Katz

Reputation: 5288

Simple jquery ajax request syntax error

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);
        }};
            });
    };

Upvotes: 0

Views: 868

Answers (3)

Jorge
Jorge

Reputation: 18237

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

Upvotes: 1

John Need
John Need

Reputation: 60

Try this

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

Upvotes: 2

Gaz Winter
Gaz Winter

Reputation: 2989

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

Upvotes: 0

Related Questions