I need the id in url to make a mysql_query. The problem is that I need to make this from an Ajax call and $_GET['id'] apparently is not working. Is there an easy way to free myself from this? Thank you :)
Here is my ajax call:
echo "<div id='loading_utilizadores' class='loading'><img src='".$CONF['HOME']."/images/structure/ajax-loader.gif'/></div>";
echo "<div id='utilizadores'></div>";
echo "<script type='text/javascript'>";
echo "CarregaAjax(\"#utilizadores\",\"#loading_utilizadores\",\"".$CONF['HOME']."/superadmin/box_utilizadores_ajax.php\", \"GET\")";
echo "</script>";
The ajax function:
function CarregaAjax(id,loading,page,method){
if(method=="GET"){
$(document).ready(function(){
//$(loading).ajaxStart(function(){
$(loading).show();
$(id).hide();
//});
$(id).load(page);
$(loading).ajaxStop(function(){
$(loading).hide();
$(id).show();
});
});
}
else{
$(document).ready(function(){
//$(method).submit(function() {
$(loading).show();
$(id).load(page,$(method).serializeArray());
$(loading).hide();
return false;
//});
});
}
And the peace of html ajax call. In this page I try to make the $_GET['id'], but with no success.
if (isset($_GET['id']))
{
$officeID = intval($_GET['id']);
}
else
{
$officeID = 0;
}
if(!isset($crm_users))$crm_users = new crm_utilizadores;
//$officeID = 12;
$resultGetUsers = $crm_users->getUsersByOfficeId($officeID);
$html = "<table class='table1' width='100%' cellpadding='5' cellspacing='1' border='0'>";
if(!empty($resultGetUsers)){
$html .= "<tr>";
$html .= "<td class='table_title1'>Utilizador</td>";
$html .= "<td class='table_title1'>Telefone</td>";
$html .= "<td class='table_title1'>Telemóvel</td>";
$html .= "<td class='table_title1'>E-mail</td>";
$html .= "<td class='table_title1'>Situação</td>";
$html .= "</tr>";
}else{
$html .= "<tr><td class='empty1'>não foram encontrados utilizadores registados neste cliente</td></tr>";
}
//finalizar a tabela
$html .= "</table>";
I guess I'm mising the point, right? :p