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 878 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

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post