thank you.. that was helpful... the guy here
does not really explain how the "msg" gets passed back to the front-end.. (not the way it's explained in Stackoverlfow thread... and, just as mentioned there, the fact he names that var "msg" is not very helpful either..)
now I continue to have a problem: if I hard-code email values on the back-end (name, email, msg) email gets sent fine, but if I pull those values from the request the email does not get sent; it seems my data is not getting sent to the server... this is how I send values to the server with ajax:
var dataToSend = "name=sName&email=sEmail&msg=sMsg&pg=loc";
subBtn.click(function() {
// if (validate()) {
$.ajax({
type: "POST",
url: "/mail/sendMail_ajax2.jsp",
data: dataToSend,
success: function(xhr) {
Success();
$('#test').html(xhr);
}
});
// }
});
is this correct?
example here
http://forum.jquery.com/using-jquery is not too instructive b/c they don't assign literals to data and dataType, so I can't be sure if I did right (do I need datatype? and what are the data types??...)
would appreciate some help.. thank you..