I have a PHP function which returns an array :
function lire( $id) {
$ret = array() ;
$sSQL = \"SELECT * FROM produit WHERE prod_code
You have to put this code block in a php file and will have to call it in the ajax function like:
var value = $.ajax({
type: "POST",
url: "some.php",
data: "name="+customvariable,
async: false
}).responseText;
also the some.php file will have
if(isset($_POST['name']))
{
$id = mysql_real_escape_string($_POST['name']);
$ret = array() ;
$sSQL = "SELECT * FROM produit WHERE prod_code = '$id' LIMIT 1" ;
$this->db->query($sSQL) ;
$ret['cnt'] = $this->db->num_rows() ;
echo $ret;
}
You will get the return value in the value variable.