• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
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 455 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 16 Mar 2021, 16:55

      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 🙂

      L 1 Reply Last reply 16 Mar 2021, 17:33 Reply Quote 0
      • L Offline
        lduboeuf @007fred50
        last edited by 16 Mar 2021, 17:33

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

        0 1 Reply Last reply 16 Mar 2021, 17:33 Reply Quote 0
        • 0 Offline
          007fred50 @lduboeuf
          last edited by 16 Mar 2021, 17:33

          @lduboeuf no there and how?

          L 1 Reply Last reply 16 Mar 2021, 17:35 Reply Quote 0
          • L Offline
            lduboeuf @007fred50
            last edited by 16 Mar 2021, 17:35

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

            0 1 Reply Last reply 16 Mar 2021, 17:39 Reply Quote 0
            • 0 Offline
              007fred50 @lduboeuf
              last edited by 16 Mar 2021, 17:39

              @lduboeuf Thanks it works now 🙂

              L 1 Reply Last reply 16 Mar 2021, 17:40 Reply Quote 1
              • L Offline
                lduboeuf @007fred50
                last edited by 16 Mar 2021, 17:40

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

                1 Reply Last reply Reply Quote 0
                6 out of 6
                • First post
                  6/6
                  Last post