Javascript is client-side, so it cannot directly access variables sent to a server through something like a post request.
If you were to do a post request to a server, which can be done in vanilla JS, you have some options for retrieving the values through the server and returning JSON that way.
For example (this comes from JS on domain1.com and is an asynchronous cross-domain request to domain2.com):
var http = new XMLHttpRequest();
var url = "domain2.com/searchTableInfo1";
var params = JSON.stringify(myJSONobj);
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);//the JSON string from server will show here
}
}
http.send(params);
Depending on server-side language on domain2.com it could look something like this (example is in PHP, but you could be running Node.js, ASP.Net, and various other options):
<?php
$data = json_decode($_POST['myJSONobj']);
//handle data processing here
$jsonToReturn = array("Enter processed data here");
echo json_encode($jsonToReturn);
?>
Using a post request however will require some server-side processing of the data on domain2.com (non-JS -- unless you are in Node of course!). If this is not possible you can attempt to do a get
asynchronous request by changing some of the vars in the JS above and it will give domain1.com the same cross-domain access, but you must understand the scope of Javascript and what it has access to as a client-side language.
Please let me know if you have more questions.