Important: Please read the Qt Code of Conduct -

Why XMLHttpRequest is 500

  • #my web servise is php

    if php return a small text ,QML 's XMLHttpRequest is ok.

    but return a more text, zhe JSON 's lenght is 900+.

    zhe XMLHttp Request is 500

  • Moderators

    @THEFree Error500 is an internal server error. AFAIK the length should not matter. Here is a small example that I tested its length is more than 900

    Item {
        width: 100
        height: 100
        function getData() {
            var xmlhttp = new XMLHttpRequest();
            var url = "";
            xmlhttp.onreadystatechange=function() {
                if (xmlhttp.readyState == XMLHttpRequest.DONE && xmlhttp.status == 200) {
  "GET", url, true);
        Button {
            text: "Get Data"
            onClicked: getData()

  • @p3c0 but im post

     var URL_Text_list = listurl;
            var UserName_Text_list = listusername;
            var PWD_Text_list = listpwd;
            var http = new XMLHttpRequest()
            var url = "";
            var params = "username="+PWD_Text_list+"&pwd="+UserName_Text_list + "&URL="+URL_Text_list;
  "POST", url, true);
            //Send the proper header information along with the request
            http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            http.setRequestHeader("Content-length", params.length);
            http.setRequestHeader("Connection", "close");
            http.onreadystatechange = function(e) {//Call a function when the state changes.
                if(http.readyState == 4 && http.status == 200 ) {
                    var object_Json = JSON.parse(http.responseText);
                    for(var i in object_Json){

  • Moderators


    • You might get more error information on the server side
    • Can you send the same info in the URL that is to say using GET instead of POST and see if the same error still persists ?

  • @p3c0 use my chromium ,zhe php return is right

  • Moderators

    @THEFree Ok. can you try to debug and try to find out more information on the server side ?

Log in to reply