I have a cshtml page that makes a call to a controller method and passes data to that method via a jquery call on form submission as follows:
$('form').submit(function () {
//create instance for datePicker.
// only after control creation we can get dateObj otherwise it throws exception.
var dateObj = $("#datepick").ejDatePicker('instance');
var obj = dateObj.option('value')
//$.datepicker.formatDate('dd/MM/yyyy', new Date());
var d = new Date(2011, 10, 30);
alert(obj);
alert(d);
$.ajax({
url: '/AutoComplete/AutocompleteFeaturesNew',
data: {
RequestedUntilDate: obj.toISOString(),
RoomNo: '13a'
},
type: 'POST',
success: function (data) {
alert("key is suucessfully got in controller through form submit, Key:" + data);
}
});
});
The controller method itself is as follows:
[HttpPost]
public JsonResult AutocompleteFeaturesNew (RequestCreateViewModel createRequestViewModel)
{
return Json(createRequestViewModel.RequestedUntilDate);
}
What I want to be able to do is, once the form has been submitted is to re-direct the control either to a) another page b) another controller method on successful submission of the form.
So, something like:
return RedirectToAction("Index");
But on the client side.
Any suggestions?