function pageSettings(){ setTriggersOnForm(); } function setTriggersOnForm(){ if($("#form-demande-remboursement-crud").length > 0){ $("#form-demande-remboursement-crud").submit(function(){ submitMyForm(); return false; }); } $(".btn-voir-planning").click(function(){ var idLocation = $(this).data("result-location-id"); var year = $(this).data("search-year"); var month = $(this).data("search-month"); var vehicleType = $(this).data("search-vehicle-type"); var energyType = $(this).data("search-energy-type"); var reservationCode = $(this).data("reservation-code"); //myAlert("Planning "+idLocation+" yearMonth="+yearMonth+" vehicleType="+vehicleType+" energyType="+energyType, "PLANNING"); riot.mount('ctrl-resplan-modal',{ 'context': '', 'url': '/fr/controle-technique/', 'locationId': idLocation, 'year': year, 'month': month, 'prestationType': 'CT', 'vehicleType': vehicleType, 'energyType': energyType, forUpdateAppointment : true, reservationCode: reservationCode }); }); }; function submitMyForm(){ showLoading(true); $.ajax({ type: "POST", dataType: "html", data: $("#").serialize(), contentType: "application/x-www-form-urlencoded; charset=UTF-8", url: "?action=submitRequestAjax", success: function(html) { $("#form-container").html(html); setTriggersOnForm(); showLoading(false); }, error: function(req,textStatus,errorThrown){ showLoading(false); setTriggersOnForm(); myAlert(errorThrown.message); } }); }