I see you already use jQuery.
I'd suggest you try the
jquery.ajax
function, is more versatile than
jquery.post
, and maybe easier to understand.
It's also more configurable than
jQuery.post
, in the sense that you can use the same syntax for both GET or POST requests
$.ajax({
type : 'POST',
url : 'ajax-example.php',
data: {
pet: val1,
pet2: val2
},
success : function(data) {
},
error: function(data) {
}
});