jQuery UI Sortable - pass additional data with serialize -
in below code, want pass value listing_id
in ajax post:
$('#listing .images').sortable({ tolerance: 'pointer', update: function(event, ui){ var data = $(this).sortable('serialize'); var listing_id = $('#listing').attr('data-id'); $.ajax({ type: 'post', datatype: 'json', url: 'listings/sortimages', data: data, success: function(result){ alert('successfully re-ordered items.'); } }); } });
i have tried:
data.push({name: 'listing_id', value: listing_id});
it says data.push not function
.
data.push({name: 'listing_id', value: listing_id});
doesn't work because data
serialized string. try
data += '&listing_id=' + listing_id;
Comments
Post a Comment