Dans mon script JS :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| function duplic_trait(plan_seq,id_org,plan_date,ligne){
var mytool_array=plan_date.split("-");
var pd = mytool_array[0] + mytool_array[1] + mytool_array[2];
try {
var xhr=getXhr();
xhr.open("GET","../../includes/page.php?act=duplicTrait&IdOrg=" + id_org + "&planSeq=" + plan_seq + "&planDate=" + pd, false);
xhr.send(null);
if(xhr.readyState == 4 && xhr.status == 200){
tableau = document.getElementById('tableauPlanif');
duplic = ligne.cloneNode(true);
tableau.insertBefore(duplic,ligne);
} else {
alert("Suppression de ligne impossible: le serveur renvoie une erreur:" + xhr.responseText);
}
} catch (ex) {
alert("Suppression de ligne impossible: " + ex.message);
}
} |
Sur ma page PHP :
echo " <IMG alt='Dupliquer le traitement' SRC=\"../../images/clone.gif\" onclick=\"duplic_trait('".$row['plan_seq']."','" . $urssaf . "','" . $dplan . "',document.getElementById('" . $numLigne ."'));\" STYLE='CURSOR:hand'><br>";
Sachant que ma ligne (<TR>) a pour id $numLigne
en gros : <TR id='1'>...
<TR id='2'>...
<TR id='3'>...
Partager