Mozilla propre specification dit simplement GET
ou POST
devrait être nativement de CORS sans contrôle en amont mais jusqu'à présent, chaque tentative POST
je l'ai fait a donné lieu à un en-tête OPTIONS
sortir. Lorsque je le change de POST
pour obtenir le code envoie immédiatement une demande correcte GET
de sorte que la partie inter-site fonctionne bien.Pourquoi CORS ne semble-t-il pas fonctionner avec POST?
Voici un maigri échantillon de ce que je fais dans Firefox:
var destinationUrl = 'http://imaginarydevelopment.com/postURL';
var invocation = new XMLHttpRequest();
if (invocation) {
invocation.open('POST', destinationUrl, true);
//tried with and without this line
//invocation.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
invocation.onreadystatechange = (function Handler() {
if (invocation.readyState == 4)
alert('Request made');
});
invocation.send(/* tried with and without data*/);
}
Voici ce que j'avais déjà travailler en chrome et IE:
var destinationUrl = 'http://imaginarydevelopment.com/postURL';
var destination = { url: destinationUrl, type: 'POST', success: AjaxSuccess, error: AjaxError,
dataType: 'text', contentType: 'application/x-www-form-urlencoded'
};
destination.data = { 'rows': rowList, 'token': token };
$jq.ajax(destination);