puneet kumar
asked on
Want to clear a form after ajax call give a return success message.
I m sending an ajax call in below method after return the success message i want to clear the form in same page so form also get cleared and success
message also print in jsp page please help me out on this thanx a ton in advance.
message also print in jsp page please help me out on this thanx a ton in advance.
$(document).ready(function() {
$("#data").click(function(evt) {
evt.preventDefault();
if(save()){
$.ajax({
url: "Test.jsp",
type: "post",
data: {
pS:$('#pS').val(),
pType:$('#pType').val(),
pCode:$('#pCode').val(),
mYear:$('#mYear').val(),
pDate:$('#pdate').val(),
ppDate:$('#ppdate').val(),
bDate:$('#bdate').val()},
success: function(responseFromServer) {
$.each(responseFromServer, function(resultMessageKey,resultMessageValue) {
$('#content').html(resultMessageKey);
});
},
error: function() {
alert(" Ajax call Failed to Update Values into Database");
}
});
}
else
{
}
});
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
EXPERT CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER