public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) {
		$jsCallback=isset($jsCallback) ? $jsCallback : "";
		$retour=$this->_getAjaxUrl($url, $attr);
		if($context===null){
			$appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n";
			$newElm = "$('#'+newId)";
		}else{
			$appendTo="\t\tnewElm.appendTo(".$context.");\n";
			$newElm = $context.".find('#'+newId)";
		}
		$retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n";
		$retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n";
		$retour.= $appendTo;
		$retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n";
		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
		$retour.="\t".$jsCallback."\n"."});\n";
		if ($immediatly)
			$this->jquery_code_for_compile[]=$retour;
			return $retour;
	}
public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) {
		$jsCallback=isset($jsCallback) ? $jsCallback : "";
		$retour=$this->_getAjaxUrl($url, $attr);
		if($context===null){
			$appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n";
			$newElm = "$('#'+newId)";
		}else{
			$appendTo="\t\tnewElm.appendTo(".$context.");\n";
			$newElm = $context.".find('#'+newId)";
		}
		$retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n";
		$retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n";
		$retour.= $appendTo;
		$retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n";
		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
		$retour.="\t".$jsCallback."\n"."});\n";
		if ($immediatly)
			$this->jquery_code_for_compile[]=$retour;
			return $retour;
	}
public function _jsonArray ( $ maskSelector , $ url , $ method = "get" , $ params = "{}" , $ jsCallback = NULL , $ attr = "id" , $ context = null , $ immediatly = false ) { $ jsCallback = isset ( $ jsCallback ) ? $ jsCallback : "" ; $ retour = $ this -> _getAjaxUrl ( $ url , $ attr ) ; if ( $ context === null ) { $ appendTo = "\t\tnewElm.appendTo($('" . $ maskSelector . "').parent());\n" ; $ newElm = "$('#'+newId)" ; } else { $ appendTo = "\t\tnewElm.appendTo(" . $ context . ");\n" ; $ newElm = $ context . ".find('#'+newId)" ; } $ retour .= "var self = $(this);\n$.{$method}(url," . $ params . ").done(function( data ) {\n" ; $ retour .= "\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n" . "\tvar created=false;var maskElm=$('" . $ maskSelector . "').first();maskElm.hide();" . "\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;" . "\tvar newElm=" . $ newElm . ";\n" . "\tif(!newElm.length){\n" . "\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n" ; $ retour .= $ appendTo ; $ retour .= "\t}\n" . "\tfor(var key in value){\n" . "\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n" . "\t\t\tif(html.indexOf('[['+key+']]')>-1){\n" . "\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n" . "\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n" . "\t\t\t}\n" . "\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n" . "\t\t\tvar selElm=$(sel,newElm);\n" . "\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n" . "\t\t}\n" . "}\n" . "\t$(newElm).show(true);" . "\n" . "\t$(newElm).removeClass('hide');" . "});\n" ; $ retour .= "\t$(document).trigger('jsonReady',[data]);\n" ; $ retour .= "\t" . $ jsCallback . "\n" . "});\n" ; if ( $ immediatly ) $ this -> jquery_code_for_compile [ ] = $ retour ; return $ retour ; }
Makes an ajax request and receives a JSON array data types by copying and assigning them to the DOM elements with the same name
@param string $url the request address
@param string $params Paramètres passés au format JSON
@param string $method Method use
@param string $jsCallback javascript code to execute after the request
@param string $context jquery DOM element, array container.
@param boolean $immediatly
Makes an ajax request and receives a JSON array data types by copying and assigning them to the DOM elements with the same name