I am using jQuery remote to verify a form field called 'users'.
Something like this:
jQuery("input[name=users]").rules("add", {
remote: {
url: "Controller/validate",
type: "get",
data: {
users: function () {
return jQuery("input[name=users]").val();
}
}
}
});
My controller:
class Controller
{
static $users = array();
static $usersflag = false;
public function validate(){
$adld = new adld();
if (!Controller::$usersflag) {
Controller::$users = $adld->function('XTZZZZ');
Controller::$usersflag = true;
}
if (in_array(Input::get('user'), Controller::$users)){
return "true";
}
return "false";
}
}
The problem i have is class "adldap" is too slow to respond. So i built a static array and use this array to verify the form field. But every time i enter a new value in 'users' field the controller and static array is reloaded making my webpage and jQuery even slower.
How should i avoid this reload issue? How to use this static array (i even tried cache with no luck) without reloading everytime.
via Dumb_Shock