Results 1 to 1 of 1

Thread: QtWebKit not able to execute $.post properly; json data missing on server side

  1. #1
    Join Date
    Jun 2014
    Posts
    1

    Default QtWebKit not able to execute $.post properly; json data missing on server side

    Good day,

    the following js code:
    Qt Code:
    1. var xmlfn = "file.xml";
    2. var json = "{\"command\":\"read\",\"fn\":\""+xmlfn+"\"}\n";
    3. var jqxhr = $.post(
    4. "http:127.0.0.1:" + port,
    5. json,
    6. this.postSuccessHandler,
    7. 'text'
    8. );
    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:
    Qt Code:
    1. "Host: 127.0.0.1:8080"
    2. "Connection: keep-alive"
    3. "Content-Length: 41"
    4. "Accept: text/plain, */*; q=0.01"
    5. "Origin: http://127.0.0.1:8080"
    6. "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"
    7. "Content-Type: application/x-www-form-urlencoded; charset=UTF-8"
    8. "Referer: http://127.0.0.1:8080/"
    9. "Accept-Encoding: gzip,deflate,sdch"
    10. "Accept-Language: en-US,en;q=0.8,ja;q=0.6,de;q=0.4,pl;q=0.2"
    11. ""
    12. "{"command":"read","fn":"file.xml"}
    13. "
    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
    Qt Code:
    1. alert(json);
    To copy to clipboard, switch view to plain text mode 
    to the js code, then Firefox/Chrome prints
    Qt Code:
    1. {"command":"read","fn":"file.xml"}
    To copy to clipboard, switch view to plain text mode 
    whereas QWebView brings
    Qt Code:
    1. {"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
    Last edited by mimic; 12th June 2014 at 13:09.

Similar Threads

  1. Post some data onto the local server by QNetworkAccessManager(Qt5)
    By stereoMatching in forum Qt Programming
    Replies: 2
    Last Post: 10th March 2014, 00:13
  2. How to disconnenct socket in server side?
    By Ali Reza in forum Newbie
    Replies: 1
    Last Post: 6th June 2012, 10:26
  3. Replies: 10
    Last Post: 5th April 2011, 04:10
  4. Retrieve Host Name at Server Side
    By hkaraoguz84 in forum Qt Programming
    Replies: 0
    Last Post: 24th August 2010, 15:02
  5. server-side app CGI Programming.
    By jcr in forum Newbie
    Replies: 0
    Last Post: 15th January 2009, 10:37

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.