dudWhen i call to my php file using ajax, it takes almost a full 30 seconds before any results are displayed.
How could i make the results more instantaneous?
my ajax is:
$("#j_search").keyup(function(){
if(($.trim($(this).val()) != '') & ($(this).val() != ' ')){
$.post('../php/ajax/j_search.php', {search: $(this).val()}, function(data){
$(".matched_results").html(data).show();
});
}
});
If you for some reason think my php is wrong, then write a sample of your own and i will test that, though i doubt it. I can not give the php source code.
I could get fired for releasing code but it just seems worth it at times like these.. Here is the a snippet of the PHP:
class SQL_COMMANDS{
//Connecting vars
private $_HOST = "localhost";
private $_USER = "root";
private $_PASS = "dud";
private function HANDLE($ERRORNUM, $ERRORMSG){//USED FOR ERROR HANDLER
$HANDLE = new HANDLE();
$HANDLE->DIRECT($ERRORNUM, $ERRORMSG);
}
function connect($DB){
$con=mysqli_connect($this->_HOST,$this->_USER,$this->_PASS,$DB);
if (mysqli_connect_errno($con)){
$this->HANDLE("001","Connection failed (DB)");
}
return $con;
// mysqli_close($con);
//$SQL_COMMANDS->connect("DB");
}
function SQL($DB, $SQL){//Construct used to transact CONNECT
return mysqli_query($this->connect($DB), $SQL);
// mysqli_close($this->connect($DB));
//$SQL_COMMANDS->SQL("DB", "SELECT * FROM TABLE WHERE ID=1");
}
function Assoc_Grab($DB, $SQL, $ARRAYGRAB){//Returns Data associated with the ARRAY directed from the QUERY
$DATA = array();
$ROW = mysqli_fetch_assoc($this->SQL($DB, $SQL));
foreach($ARRAYGRAB as $pointer){
array_push($DATA,$ROW[$pointer]);
}
//print_r($SQL_COMMANDS->Assoc_Grab('DB', "SELECT * FROM TABLE WHERE ID='1'", array('NAME')));
return $DATA;
}
}