Vote count:
0
I've trouble to realize this:
I've a contact form, which submit some information from a div on submit. Theses results get display on the same time as submitting the form.
everything works fine, and Ajax say to fill every form to submit.
However, in the email form, it does say when it's missing the "@" to submit, and submit it by email only when the form is fill with a "@", which is perfect.
The problem I have is that, if the user fill the email form without the "@", it shows the results of my div "resultKeeper". It should make appear the result only if the email form contain a "@" also.
How can i fixe this ?
here is my JS:
}
var uname = $("input[name=senderName]").val();
var uemail = $("input[name=senderEmail]").val();
var msg = $("input[name=message]").val()
if ((uname != null && uname!="")&& (uemail!=null && uemail!="") && (msg !=null && msg!="")){
console.log("msg'" + msg + "'");
}else{
resultSet='<div id="messageerror">Please complete the form to see your result.</div>';
}
$('#resultKeeper').html(resultSet).show();
})
}
};
jQuiz.init();
})
$(function() {
$('#quesForm').on('submit',function(e) {
e.preventDefault();
// I am fetching the form values you could get them by other selectors too
var uname = $("input[name=senderName]").val();
var uemail = $("input[name=senderEmail]").val();
var msg = $("input[name=message]").val()
if ((uname != null && uname!="")&& (uemail!=null && uemail!="") && (msg !=null && msg!="")){
$.post('submit.php',{senderName:uname,senderEmail:uemail,message:msg,results:$('#resultKeeper').html(),subject:'Subject of your e-mail'},function(result){
// result variable contains your response text
// I guess you trying to update your response
// notice I have used html(result) as you have just used html()
$('#responseMessage').html(result);
});
}
// you dont require `return false`
// you have already did it using e.preventDefault();
});
});
here is the full jsfiddle with htmland php also . . http://ift.tt/1fyYDxw
Really appreciate all your help,
thank you so much
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire