Hi All,
I would like to know how the ajax failure call back works.
I am throwing an exception from the server side code through struts,
however on specific cases like when a user name already exists or invalid
password I would be throwing an exception with a specific message.
I would like this exception message to be shown as javascript alert, I have
the following ajax function for the save action,
jQuery("#save").click(function(){
if(jQuery('#userform').jVal()){
jQuery.ajax({
type: "POST",
url: "saveOrUpdateUser.do",
dataType:"html",
data:"userId="+encodeURIComponent(document.forms[0].userId.value),
success:function(response){
clear();
alert("Admin user details saved successfully!!!");
},
error:function(event, request, settings){
alert("Save failed!"+event);
}
});
}
}
);
I also tried using error:function(response), and ended up no where.
Could any one please let me know how to do this? Also, I would like to know
some pointers to ajax related examples.
Thank you,
A.Balaji