jquery - How to redirect the request to another controller after successful ajax request? -


here code

    $("#ajaxform").submit(function(e){           var info = $(this).serialize();           $.ajax(           {               url : "ctrl1",               type: "post",               data : info,               success:function(data, textstatus, jqxhr)                {                     $('.valid-error').html(data);                     if(data == "success"){                           $.get("ctrl2", info); // request not come servlet                     }               }           });           e.preventdefault()          }); $(".submit").click(function(){       $("#ajaxform").submit(); }); 

how redirect request controller after successful ajax request , data == "success"? have breakpoint in servlet's doget() , not called. code here not work tested it. how make request work?

$("#ajaxform").submit(function(e){           var info = $(this).serialize();           $.ajax(           {               url : "ctrl1",               type: "get",               async: false,               data : info,               success:function(data, textstatus, jqxhr)                {                     $('.valid-error').html(data);                     if(data == "success"){                             window.location.href = "/controllername/viewname";                     }               }           });           e.preventdefault()          }); $(".submit").click(function(){       $("#ajaxform").submit(); }); 

here specify controller name , view name


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -