0
<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.

ZEQUET
  • 51
  • 1
  • 7
  • 2
    And you most probably get a descriptive error in your browser console explaining why....correct? If so...put that error in a search engine and will see thousands of results as to what it is. There's even a specific website just for this situation – charlietfl Jun 25 '16 at 23:06
  • 2
    It is probably a CORS issue, you cannot, by default, access other domains by javascript. If the service does not support CORS you will need to proxy the request through a web method (of some sort) that is in your own domain. – Crowcoder Jun 25 '16 at 23:08
  • I linked one answer...there are hundreds of others on this site. Always do a search of error messages first – charlietfl Jun 25 '16 at 23:14

0 Answers0