[eluser]Paganotti[/eluser]
I resolved All.
In the controller I have:
function Ajaxtest()
{
parent::Controller();
//load the helper url
$this->load->helper('url');
//to load my model
$this->load->model("mymodel"); // Moved up 2 lines
//load xajax library
$this->load->library('xajax');
//$this->xajax->debugOn();
//to record my xajax function
$this->xajax->registerFunction(array('test_function',&$this,'test_function'));
//execute process requests
$this->xajax->processRequests();
//carico la libreria per la creazione di template
$this->load->library('parser');
}
In the function xajax:
function test_function($Scaffale)
{
$statoRipiani = $this->mymodel->getStatoRipiani();
$objResponse = new xajaxResponse();
$objResponse->addAssign("SomeElementId","innerHTML", "Scaffale passato:".$this->getTabRipiani());
return $objResponse->getXML();
}
In above xajax function I call $this->mymodel->getStatoRipiani() that it has this code:
function getTabRipiani()
{
$tabRipiani = '<table align = "center">';
$StatoRipiani = $this->mymodel->getStatoRipiani();
for($i = 0; $i < count($StatoRipiani); $i++)
{
$tabRipiani .= "<tr>
<td>";
if($StatoRipiani[$i] == 2)
$tabRipiani .= "<img src=\"".base_url()."system/application/immagini/scaffali_ripiani/Ripiani/pieno_ripiano.png\" width=\"100%\" height=\"20\" align =\"top left\"/>";
else if($StatoRipiani[$i] == 1)
$tabRipiani .= "<img src=\"".base_url()."system/application/immagini/scaffali_ripiani/Ripiani/mezzo_ripiano.png\" width=\"100%\" height=\"20\" align =\"top left\"/> ";
else
$tabRipiani .= "<img src=\"".base_url()."system/application/immagini/scaffali_ripiani/Ripiani/vuoto_ripiano.png\" width=\"100%\" height=\"20\" align =\"top left\"/> ";
$tabRipiani .= " </td>
</tr>";
}
$tabRipiani .= "</table>";
return $tabRipiani;
}
in above function I use base_url() function. This funtion belongs in codeigniter helper url.
<strong>The helper or another library of codeigniter must be called first you call $this->xajax->processRequests();</strong> becouse xajax not know what is base_url() function.
I hope you have understand becouse I don't speak very well english.
thank you all for your posts.