ajax
ajax
I find ajax with jquery more confusing than with regular JS, b/c in jQuery you don't declare XMLHttpRequest object.. so how do you do something like
$('#testFromAjax').append(xmlHttp.responseText); ???
(assuming of course that 'xmlHttp' eval's to XMLHttpRequest object)
in example I mention here,
http://forum.jquery.com/topic/ajax-php-7-3-2011-1
namely http://www.bitrepository.com/a-simple-ajax-contact-form-with-php-validation.html
I don't understand where var 'msg' is declared, I know it comes from the back-end, but HOW is it passed to the front-end??? (how do you do this w/o responseText or something similar??)
I'm trying to connect to a send-mail jsp with ajax.. the email is not getting sent.. I want to test if the ajax connection is being made at all.. don't know how do it w/o something like
xmlHttp.responseText
thank you...
PS: this is my jQuery ajax code for connecting to send-email jsp:
var dataToSend = "name=sName&email=sEmail&msg=sMsg;
$('#submitBtn').click(function() {
// if (validate()) {
$.ajax({
type: "POST",
url: "/mail/sendMail_ajax.jsp",
data: dataToSend,
success: function() {
Success(); // (hides form and populates success div)
}
});
// }
});
thank you..