Sucao
asked on
Need a way to send multiple data for $.post()
I need to send some data to a php script. Some of the data is coming from a textarea and some of it is coming from a variable (advice_ID) defined earlier in the javascript. Below is the code that I am using trying to send the data.
when I leave out the "+ {ID : advice_ID}" the code inputs form_data fine but I need to send that advice_ID.
when I leave in "+ {ID : advice_ID}" the code adds "[object Object]" to the end of the form_data.
don't know if that helps you diagnose the problem.
when I leave out the "+ {ID : advice_ID}" the code inputs form_data fine but I need to send that advice_ID.
when I leave in "+ {ID : advice_ID}" the code adds "[object Object]" to the end of the form_data.
don't know if that helps you diagnose the problem.
$.getJSON('../advice/php/get_advice_start.php', {ID : top.window.location.hash.substring(1)}, process_advice);
function process_advice(data) {
advice_ID = data.id;
}
$('#comment_form').submit(function() {
var form_data = $(this).serialize();
$.post('../advice/php/post_comment.php', form_data + {ID : advice_ID}, comment_callback);
function comment_callback(data) {
}
return false;
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER