HTML-Formular absenden mit 400 fehlerhaften AnfragenHTML

HTML-Programmierer
Guest
 HTML-Formular absenden mit 400 fehlerhaften Anfragen

Post by Guest »

Ich sende ein HTML-Formular mit der POST-Methode an den REST-Webdienst (eXist db). Eine normale Übermittlung ergibt 400 ungültige Anfragen

Hier ist mein HTML-Code

Code: Select all


/* function createXMLHttpRequest()
{
if( typeof XMLHttpRequest == "undefined" )
XMLHttpRequest = function()
{
try
{
return new ActiveXObject("Msxml2.XMLHTTP.6.0")
}
catch(e) {}
try
{
return new ActiveXObject("Msxml2.XMLHTTP.3.0")
}
catch(e) {}
try
{
return new ActiveXObject("Msxml2.XMLHTTP")
}
catch(e) {}
try
{
return new ActiveXObject("Microsoft.XMLHTTP")
}
catch(e) {}
throw new Error( "This browser does not support XMLHttpRequest." )
};
return new XMLHttpRequest();
}

var AJAX = createXMLHttpRequest();*/
function submitForm()
{

//AJAX.open("POST",'http://localhost:8899/exist/rest/db/xql/sample.xq');
// AJAX.send(document.form.xmlData.value);
document.form.submit();
};











Der kommentierte Code besteht darin, eine POST-Anfrage mit AJAX zu senden.
Ich habe die http-Header-Anfrage und -Antwort für die Formularübermittlung und die AJAX-Übermittlung erfasst.
Dies sind die Anfrage-Header:

HTML-Formular-Sende-Header:

Code: Select all

(Request-Line)  POST /exist/rest/db/xql/sample.xq HTTP/1.1
Host    localhost:8899
User-Agent  Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0
Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip, deflate
Connection  keep-alive
Content-Type    text/plain
Content-Length  26
AJAX-Anfrageheader:

Code: Select all

(Request-Line)  POST /exist/rest/db/xql/sample.xq HTTP/1.1
Host    localhost:8899
User-Agent  Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0
Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip, deflate
Connection  keep-alive
Content-Length  16
Content-Type    text/plain; charset=UTF-8
Origin  null
Pragma  no-cache
Cache-Control   no-cache
Ich verstehe nicht, was in meinem Code falsch ist.
Ich arbeite seit 2 Tagen daran, aber ich finde keine Lösung.
Bitte schauen Sie Gehen Sie darauf ein und bieten Sie eine Lösung an.

Vielen Dank im Voraus.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post