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



  • 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");
            }
    


  • @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.



  • Thx Eeli K .


Log in to reply