Is it possible to redirect to a different url - for example a Thank you page from a surface controller. Im using the following but the Thank you page is inside the Original page - I need it to redirect to a new URL.
I have used the following:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult SubmitPersonalDetailsForm(PersonalDetails model)
{
return new RedirectResult(ViewDelegateURL, true);
return this.RedirectToUmbracoPage(ViewDelegateId);
Add an onsuccess function and assign it in your ajaxform options.
var onSuccess = function(result) {
if (result.url) {
// if the server returned a JSON object containing an url
// property we redirect the browser to that url
window.location.href = result.url;
}
Redirect from Surface Controller to different URL
Hi,
Is it possible to redirect to a different url - for example a Thank you page from a surface controller. Im using the following but the Thank you page is inside the Original page - I need it to redirect to a new URL.
I have used the following:
Any ideas what I need to do to get this working?
Hi Jon,
Can't you just use
return Redirect(ViewDelegateURL);
?-Joep
I must be doing something wrong - it doesnt actually redirect - but puts the new page inside the old page
you should definitely just be able to do
return Redirect("/some-url");
or
return RedirectToUmbracoPage(umbracoPageId);
Would this stop it from working?
My Front end partial form is using this:
@using (Ajax.BeginForm("SubmitPersonalDetailsForm", "PersonalDetailsSurface", new AjaxOptions() {
In your controller, return JSON
return Json(new { url = yoururl });
Add an onsuccess function and assign it in your ajaxform options.
}
Yes, you can't redirect from an Ajax post, you need to return the URL and redirect in the onsuccess function
is working on a reply...