1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
var Valide=false,id;
function Initialiser_formulaire(lerel) {
var titre = "", imag = "", date = "", devise = "", ordrecat = "", envoimar = "", activecat = "",
grpreperp = "", ladonner = { id: parseInt(lerel) };
$.ajax({
type: "POST",
url: "/Categorie/Charger_formulaire?id="+lerel,
//data: JSON.stringify(ladonner),
contentType: "application/json; charset=utf-8",
dataType: "json",
cache: false,
beforeSend: function () { ladonner.id = lerel; }
}).success(function (CHmsg) {
if (CHmsg) {
for (var i = 0; i < CHmsg.length; i++) {
Valide = true;
titre = CHmsg[i].Titre;
imag = CHmsg[i].Image;
date = CHmsg[i].Date;
devise = CHmsg[i].devis;
ordrecat = CHmsg[i].order_cat;
}
if (Valide) {
$("#txtTitreModif").val(titre);
$("#txtDate").val(date);
$("#imgmdf").attr("src", "../photos/" + imag);
$("#txtdevmod").val(devise);
$("#txtOrdreCatmod").val(ordrecat);
}
}
}); // fin ajax
return Valide;
}
$(function(){
$.fn.Affiche=function(){
id=$(this).attr("id");
if(Initialiser_formulaire(id))
{
alert("Existe :"+id);
}
else
{
alert("N existe pas :"+id);
}
}
$("#Tblaff").on("click", "tr.cont", $.fn.Affiche);
}); |
Partager