I give you what I want in PHP :
foreach($myarray as $key=>$value) { ${$key} = $value; }
Now, can we do it with JS/jQuery ?
This is the jQuery input, I want the classTD value as key, in other words the equivalent of the famous PHP statement ${$key} in the example above:
data = {};
$('#resul_rech_doc_fact tr.document-2 td').each(function(index) {
var classTD = $(this).attr('class');
var contentTD = $(this).text();
data = $.extend(data , { classTD : contentTD });
});