make Ajax post on a different server

I have a question on making Ajax post on a different server. When a user clicks a button (submit_q) an Ajax post will be submitted like below:

AJAX Request Method: POST

AJAX Request URL: http://a_server/getdatabutton

AJAX Request Body: { my JSON DATA }

I followed your instructions on advanced-shiny github (https://github.com/daattali/advanced-shiny/tree/master/api-ajax) but did not have much luck. Here is what I had in app.js function:

app = function() {

  return {

    init : function() {

      $("submit_q").click(function(){

        $.post("http://a_server/getdatabutton",

          {"datatype":"wafer1",

           "requestid":"abc123"

           },

          function(data, status){alert("Data: " + data + "\nStatus: " + status); });

      });

    }

  };

}();

$(function () { app.init(); });

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.