I am using jQuery sortable to allow users to be able to sort which order images show up. However I am having trouble sending the actual order to the php script
JS:
$( ".sort-p-images" ).sortable({
stop: function(event, ui){
var form_data = { order: $(".sort-p-images").sortable('toArray')) }
$.ajax({
url: "update_img_order",
type: "POST",
data: form_data,
dataType: "json",
cache: false,
success: function(json)
{
console.log('ajax done');
}
});
}
});
The error I am getting is:
Uncaught SyntaxError: Unexpected token }
Why can’t I include that under the variable form_data?
Remove the excess parenthesis:
var form_data = { order: $(".sort-p-images").sortable('toArray')) }Change it to:
var form_data = {order: $(".sort-p-images").sortable('toArray')};