samedi 2 juillet 2016

Jquery - not being able to bring data from server [duplicate]


This question already has an answer here:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>

<script>
    $(document).ready(function () {
        $("button").click(function(){
            //$.post("http://localhost/api/ajax.asp",  //This is working
            $.post("http://zequet.somee.com/ajax.asp", // This is not working
    {
      name: "100"
    },
    function(data,status){
        console.log(data);
        document.getElementById("change").innerHTML = data;


        if (data.success) {
            alert("STATUS: " + status);
        }
        else {
            alert("STATUS: " + status);
        }
    });
 });

});

Ticket: <span id="change"></span>
<button>Test</button>

And this is the ajax.asp code

<%
    Dim fname
    fname = Request.Form("name")
    fname = fname + 1
    Response.Write(fname)
%>

It works fine when using $.post("http://localhost/api/ajax.asp" but it doesn't work when using $.post("http://zequet.somee.com/ajax.asp" when executing from my local computer.


Aucun commentaire:

Enregistrer un commentaire