Q:

Perform RedirectToAction in AJAX post call

I have passed the Model object from the View to controller action method through the AJAX post call. Inside the action method, we have a some business logic to be perform based on the received input fields. if business logic fails, then we will return the error message to user else, then we need to redirect the user to some other page. in this case,  Redirection to other page is not working in the AJAX post call. 
Could you please provide me the any alternative approach on this?
Note:-  i need to perform this post operation in the AJAX call.
Thanks

A:

You can simply check if the status is an error and if so redirect in your ajax call
$.ajax({
       url: '/ThingToDo/',
       type: 'POST',
       contentType: 'application/json; charset=utf-8',
       data: data,
       success: function (status) {
       if (!status.error) { alert(!status.error); }
       else { window.location.href = "/Redirecthere/"; }
       }

