I am trying to pass in mutliple data into AJAX .post(). This is what I've done so far:
$('form#tutorTableForm').live('submit', function()
{
var cid = $('#courseSelect').val();
var lid = $('#lessonSelect').val();
var lessonCount = $('#lessonSelect option:selected').attr('id');
$.post('', $(this).serialize(), function(response){
alert(response);
});
return false;
});
I want to also pass in cid and lid. How would I do that?
I'm using live instead of on because our app is using the old version.
I guess you could create an object that contains all the data, like this:
var cid = $('#courseSelect').val();
var lid = $('#lessonSelect').val();
var lessonCount = $('#lessonSelect option:selected').attr('id');
var postdata = {
formdata: $(this).serialize(),
cid: cid,
lid: lid
};
$.post('', postdata, function(response){ alert(response); });
place them inside the form as input hidden or whatever and the serialize should add them automatically. without seeing your html it's a bit difficult to see exactly what you need.