I have been working on a JQuery AJAX response, and need help redirecting to another view. Here is the code snippet:
$.ajax({
url: "/Home/PersistSelections",
type: 'post',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: JSON.stringify(selectedItems),
done: function (response) {
window.location.href = "Home/GoToBooking";
}
})
However, the redirection in the 'done' section doesn't seem to be functioning as expected. I have tried using 'success' with no luck. I am not sure about the parameter that should be passed along with the response.
Additionally, I came across this code snippet:
return JavaScript("window.location = 'http://www.google.co.uk'");'
In my controllers, I have JavascriptResult
resolving, but when attempting to use return Javascript
, I encounter issues resolving the references. My project is based on ASP.NET Core 2.2.