I have to wait untill Xajax gets its response from server so I can use thise reponse with a Jquery plugin :
In this example I have to wait untill the select box is created (by an XAJAX call) before I apply the plugin .chosen() on it:
<? $objResponse = new xajaxResponse();
$objResponse->assign($selectID, 'innerHTML', $codeThatCreatesSelectBox);
$objResponse->script('$(function(){ $("#selectID").chosen(); });');
return $objResponse; ?>
I tried using jquery function AjaxComplete() but it dosen’t seem to work since Jquery and Xajax are two different things :
$objResponse->script('$("#selectID").ajaxComplete(function() {$("#selectID").chosen(); });');
How Can I do that ?
You need to do a synchronous AJAX-request.
The difference is discussed here: AJAX sync and async difference
Here is how you do it in XAJAX: http://community.xajax-project.org/topic/6460/synchonous-requests-with-parameters-fails-completely/