aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/api/xmlhttprequest/using_xmlhttprequest
diff options
context:
space:
mode:
authorSphinxKnight <SphinxKnight@users.noreply.github.com>2022-03-18 07:03:30 +0100
committerGitHub <noreply@github.com>2022-03-18 07:03:30 +0100
commit371b1302c5ab1ed0c461eb389e6b91d270e219bd (patch)
treefcea74f16afe52be8f34d63e6960ab89ee327de5 /files/fr/web/api/xmlhttprequest/using_xmlhttprequest
parentc32682b053bad2602a8c910cc7e4106acaefade1 (diff)
downloadtranslated-content-371b1302c5ab1ed0c461eb389e6b91d270e219bd.tar.gz
translated-content-371b1302c5ab1ed0c461eb389e6b91d270e219bd.tar.bz2
translated-content-371b1302c5ab1ed0c461eb389e6b91d270e219bd.zip
fixes 4269-introduced breakage (#4697)
Diffstat (limited to 'files/fr/web/api/xmlhttprequest/using_xmlhttprequest')
-rw-r--r--files/fr/web/api/xmlhttprequest/using_xmlhttprequest/index.md24
1 files changed, 13 insertions, 11 deletions
diff --git a/files/fr/web/api/xmlhttprequest/using_xmlhttprequest/index.md b/files/fr/web/api/xmlhttprequest/using_xmlhttprequest/index.md
index 9c366f23af..aae0a7236e 100644
--- a/files/fr/web/api/xmlhttprequest/using_xmlhttprequest/index.md
+++ b/files/fr/web/api/xmlhttprequest/using_xmlhttprequest/index.md
@@ -532,21 +532,23 @@ function AJAXSubmit (oFormElement) {
var oReq = new XMLHttpRequest();
oReq.onload = ajaxSuccess;
if (oFormElement.method.toLowerCase() === "post") {
- oReq.open("post", oFormElement.action, true);
+ oReq.open("post", oFormElement.action);
oReq.send(new FormData(oFormElement));
- else {
- var oField, sFieldType, nFile, sSearch =
- for (var nItem = 0; nItem < oFormElement
+ } else {
+ var oField, sFieldType, nFile, sSearch = "";
+ for (var nItem = 0; nItem < oFormElement.elements.length; nItem++) {
oField = oFormElement.elements[nItem];
- if (!oField.hasAttribute("na
- sFieldType = oField.nodeName
+ if (!oField.hasAttribute("name")) { continue; }
+ sFieldType = oField.nodeName.toUpperCase() === "INPUT" && oField.hasAttribute("type") ?
+ oField.getAttribute("type").toUpperCase() : "TEXT";
if (sFieldType === "FILE") {
- for (nFile = 0; nFile < oField.files.length; sSearch += "&" + esca
- }
-
-
+ for (nFile = 0; nFile < oField.files.length;
+ sSearch += "&" + escape(oField.name) + "=" + escape(oField.files[nFile++].name));
+ } else if ((sFieldType !== "RADIO" && sFieldType !== "CHECKBOX") || oField.checked) {
+ sSearch += "&" + escape(oField.name) + "=" + escape(oField.value);
+ }
}
- oReq.open("get", oFormElement.action.replace(/(?:\?.*)?$/, sSearch.replace(/^&/, "?")), true);
+ oReq.open("get", oFormElement.action.replace(/(?:\?.*)?$/, sSearch.replace(/^&/, "?")), true);
oReq.send(null);
}
}