Good day,
the following js code:
var xmlfn = "file.xml";
var json = "{\"command\":\"read\",\"fn\":\""+xmlfn+"\"}\n";
var jqxhr = $.post(
"http:127.0.0.1:" + port,
json,
this.postSuccessHandler,
'text'
);
var xmlfn = "file.xml";
var json = "{\"command\":\"read\",\"fn\":\""+xmlfn+"\"}\n";
var jqxhr = $.post(
"http:127.0.0.1:" + port,
json,
this.postSuccessHandler,
'text'
);
To copy to clipboard, switch view to plain text mode
is not able to properly send the data section (json string) to the server side.
When using the Firefox/Chrome browser, the server output is:
"Host: 127.0.0.1:8080"
"Connection: keep-alive"
"Content-Length: 41"
"Accept: text/plain, */*; q=0.01"
"Origin: http://127.0.0.1:8080"
"User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/34.0.1847.116 Chrome/34.0.1847.116 Safari/537.36"
"Content-Type: application/x-www-form-urlencoded; charset=UTF-8"
"Referer: http://127.0.0.1:8080/"
"Accept-Encoding: gzip,deflate,sdch"
"Accept-Language: en-US,en;q=0.8,ja;q=0.6,de;q=0.4,pl;q=0.2"
""
"{"command":"read","fn":"file.xml"}
"
"Host: 127.0.0.1:8080"
"Connection: keep-alive"
"Content-Length: 41"
"Accept: text/plain, */*; q=0.01"
"Origin: http://127.0.0.1:8080"
"User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/34.0.1847.116 Chrome/34.0.1847.116 Safari/537.36"
"Content-Type: application/x-www-form-urlencoded; charset=UTF-8"
"Referer: http://127.0.0.1:8080/"
"Accept-Encoding: gzip,deflate,sdch"
"Accept-Language: en-US,en;q=0.8,ja;q=0.6,de;q=0.4,pl;q=0.2"
""
"{"command":"read","fn":"file.xml"}
"
To copy to clipboard, switch view to plain text mode
but when I use the QWebView, the json part is missing (the socket reads two empty lines after the header).
The only clue I have found until now is that when I add
alert(json);
alert(json);
To copy to clipboard, switch view to plain text mode
to the js code, then Firefox/Chrome prints
{"command":"read","fn":"file.xml"}
{"command":"read","fn":"file.xml"}
To copy to clipboard, switch view to plain text mode
whereas QWebView brings
{"command":"read","fn":"file.xml"}
{"command":"read","fn":"file.xml"}
To copy to clipboard, switch view to plain text mode
Any ideas on how to make QtWebKit/QWebView send the json data to the server component?
Cheers
Bookmarks