UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    html request, no data back

    Scheduled Pinned Locked Moved Solved App Development
    6 Posts 2 Posters 457 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • 0 Offline
        007fred50
        last edited by

        Hello,

        The script does not work on real devices, but it works fine in emulator

        var http = new XMLHttpRequest()
        var url = "http://ubuntutouch.people8people.com:8080/news/app/searcNews.php";
        var params = "searchNews=" +searchText;
        http.open("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() { // Call a function when the state changes.
                    console.log(http.responseText)
        }
        
        http.send(params);
        

        Do i have to setup on my ubuntu touch devices?

        Thanks For your time 🙂

        lduboeufL 1 Reply Last reply Reply Quote 0
        • lduboeufL Offline
          lduboeuf @007fred50
          last edited by

          @007fred50 have you declared "networking" policy in app armor file ?

          0 1 Reply Last reply Reply Quote 0
          • 0 Offline
            007fred50 @lduboeuf
            last edited by

            @lduboeuf no there and how?

            lduboeufL 1 Reply Last reply Reply Quote 0
            • lduboeufL Offline
              lduboeuf @007fred50
              last edited by

              @007fred50 example here: https://github.com/lduboeuf/t-tris/blob/master/ttris.apparmor

              0 1 Reply Last reply Reply Quote 0
              • 0 Offline
                007fred50 @lduboeuf
                last edited by

                @lduboeuf Thanks it works now 🙂

                lduboeufL 1 Reply Last reply Reply Quote 1
                • lduboeufL Offline
                  lduboeuf @007fred50
                  last edited by

                  @007fred50 great, don't forget to mark this topic as "Solved"

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post