I send a variable from js to php and in php i am running a query using the variable i got from js. After running the query i need to return the output of the query to js. I succeeded in sendind the variable and running the query.But unable to return the output.How can i return it?
Here is the code
JS
function abc () {
var url = 'server/set_data.php';
var paramstring = "vr=ViewLog&val=" + activityID1;
ctype = "TEXT";
AJAXRequest(url, paramstring, ctype, "VerifyData");
}
PHP
if(trim($_REQUEST[vr]) == 'ViewLog')
{
if (trim($_REQUEST[val]) != "")
{
$sql="select abc from table where id='".$_REQUEST[val]."'";
echo $sql;
}
}
Try this jQuery code, it will work