$.getJSON(submitUrl, function(data) { if (data == 'success'){ console.log("redirecting.."); window.location.replace("report-success.html"); } } );