Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. javascript data post local server works but on internet server not working ?
Forum Updated to NodeBB v4.3 + New Features

javascript data post local server works but on internet server not working ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 541 Views
  • 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.
  • mehmetakM Offline
    mehmetakM Offline
    mehmetak
    wrote on last edited by
    #1

    Hi this javascript code works localhost but not work on internet .
    why ?
    thx for helping

     function getData() {
                var xmlhttp = new XMLHttpRequest();
                var url = "http://www.meydanipazar.com/customers.php";
                //time.text = "yükle"
                var params = "";
    
                xmlhttp.onreadystatechange=function() {
                    if (xmlhttp.readyState == XMLHttpRequest.DONE && xmlhttp.status == 200) {
                        myFunction(xmlhttp.responseText);
                        //siparisList.model.append(xmlhttp.responseText);
                    } else { console.log("Error sending state " + params + " !!"); }
                }
    
                xmlhttp.open("POST", url, true);
                xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8");
                xmlhttp.send("lorem=Henry&lname=Ford");
            }
    
    E 1 Reply Last reply
    0
    • mehmetakM mehmetak

      Hi this javascript code works localhost but not work on internet .
      why ?
      thx for helping

       function getData() {
                  var xmlhttp = new XMLHttpRequest();
                  var url = "http://www.meydanipazar.com/customers.php";
                  //time.text = "yükle"
                  var params = "";
      
                  xmlhttp.onreadystatechange=function() {
                      if (xmlhttp.readyState == XMLHttpRequest.DONE && xmlhttp.status == 200) {
                          myFunction(xmlhttp.responseText);
                          //siparisList.model.append(xmlhttp.responseText);
                      } else { console.log("Error sending state " + params + " !!"); }
                  }
      
                  xmlhttp.open("POST", url, true);
                  xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8");
                  xmlhttp.send("lorem=Henry&lname=Ford");
              }
      
      E Offline
      E Offline
      Eeli K
      wrote on last edited by
      #2

      @mehmetak Possibly this is a case of CORS, not directly related to Qt (only that Qt uses a javascript engine). See e.g. https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS.

      1 Reply Last reply
      1
      • mehmetakM Offline
        mehmetakM Offline
        mehmetak
        wrote on last edited by
        #3

        Thx Eeli K .

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved