I am updating an older script that I have .. I am now trying to pull multiple bits of data from a php page that is posted to using jquery. Here is my current code:
$(document).ready(function(){
$("#myform1").validate({
debug: false,
submitHandler: function(form) {
// do other stuff for a valid form
$.post('process.php', $("#myform1").serialize(), function(data) {
$('#results').fadeIn('fast');
$('#results').html(data);
setTimeout(function() {
$('#results').fadeOut('slow');
}, 2500);
});
}
});
});
What I am looking to do is pull two to three DIFFERENT variables from this page. I am not sure this is at all possible, I read about .post and can only find it returning .data which is the HTML output of the entire script. What if I wanted to return:
1) success,success update message, success html
2) database error (duplicate), fail update message, fail update html
3) database error, (unknown database error - returned value), fail update html
My PHP will return either 1, 2, or 3. Either way it will return 3 variables. How do I pass this to my JQuery that originally posted the form? Is it at all possible?
-- Zak