phpjqueryjsonpcross-server

How to send data to a cross-server php file?


While developing a native Android app using Dreamweaver's "build" functionality, I found out that I had to use Jquery's JSONP functionality to access dynamic data. The dynamic data, pulled from a mySQL database and populated into a php file, is considered "cross-server," because the web-language-created Android app resides in the Android device, while the php file resides on the web server (I think? I couldn't ajax in the data like I could when I hosted the web app.).

I can display the dynamic data from the php file easily with a JSONP scrip inject...but what if I wanted to do a user-specified filter on the data? (Send to the php file which "linkID" was clicked)

I've read that jquery's .getJSON() function can send data (currently only using it to pull data):

function jsoncallback(data){
console.log(data);
}
$.getJSON("http://crossServerPhpFile.php?jsoncallback=?",
  { linkID: "0"});

But is there a way to send a GET variable to the cross-server php file?


Solution

  • Not sure really if i understood it correctly but here is what i think you can do:

    $.getJSON("http://crossServerPhpFile.php?linkId=0&jsoncallback=?");
    

    sending the linkid directly in the url.