Gustavo Gustavo - 1 year ago 65
HTML Question

Why ajax does not redirect me to another html page?

I want to redirect the user to another html page after a successful ajax request, but nothing happens. I have to mention the fact that the html page requires authentication, but at the moment the user makes the request he is logged in already.

This is the js:

$("form").submit(function (env) {
$("#submitbtn").prop('disabled', true);
var request = JSON.stringify($("#newRequest-form").serializeObject());
method: "POST",
url: "/api/holidays",
data: request,
contentType: "application/json",
dataType: "html",
success: function () {
/*$("#form_result").text("Submitted succesfully");
error: function (error) {
$("#form_result").text("Error: creating the request. Status: " + error.status + " - " + error.statusText);
$("#submitbtn").prop('disabled', false);

Answer Source

is not a function, it's a property. Try this:

window.location.href = "summary.html";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download