0
Ich habe die folgende AJAX POST-Anfrage, die serialisierte Formulardaten an den Server sendet:window.location.assign mit AJAX in Firefox nicht funktioniert
// Handle form submission.
$('#evaluationform').on('submit', function(e){
e.preventDefault();
ajaxObject = {
url: $("#evaluationform").attr("action"),
type: 'POST',
dataType: 'json',
xhrFields: {
withCredentials: true
},
crossDomain: true,
data: $("#evaluationform").serialize(),
};
$.ajax(ajaxObject)
.success(function(data,status,xhr) {
window.location.assign("http://example.com/survey/instruction/thankyou.html");
})
.fail(function(data,status,xhr) {
window.location.assign("http://example.com/survey/instruction/fail.html");
})
.always(function(data,status,xhr) {
console.log(status);
});
});
Während der assign Weg in Chrome und Safari folgt, ist es nicht in Firefox. Die Zuweisung wird in Firefox ignoriert und spuckt mich stattdessen an die API-URL aus, die im Action-Attribut meines Formulars definiert ist.
Es gibt ein mögliches Sicherheitsproblem hier: [in der Dokumentation] (https://developer.mozilla.org/en-US/docs/Web/ API/Standort/zuweisen). –