Capture AJAX response and assign to a variable using JQUERY

function checkforduplicateempname(){
 var message=true;
 /*Assigning AJAX response to a javascript variable*/
 var empId = $.ajax({
   url: 'checkforduplicateempname.relay',
   data: oMyForms,
   cache: false,
   contentType: false,
   processData: false,
   global: false,
   type: 'POST',
   success: function(data){
    return data;
    $("#empname").notify("Unable to check for duplicate title.","error");
}).responseText; //end of ajax capturing the response
    $("#empaname").notify("Duplicate Title.","error");

return message;
}//end of function


Post a Comment

Popular posts from this blog

Spring MVC- Redirect from one controller to another

Integrating Struts2 with Spring Security using Custom Login Form