templates/backend/productions/js.html.twig line 1

Open in your IDE?
  1. <script>
  2.     function save(){
  3.         
  4.         var form = new FormData($("#formProduction")[0]);
  5.         $.ajax({
  6.             url: "{{ path('app_backend_productioncompany_productionsave') }}",
  7.             data: form,
  8.             type: "POST",
  9.             contentType: false,
  10.             processData: false,
  11.             cache: false,
  12.             dataType: "json",
  13.             error: function (err) {
  14.                 if ('msg' in err) {
  15.                     alert(err.responseJSON.msg);
  16.                 }
  17.             },
  18.             success: function (data) {
  19.                 if (data.response == 'success') {
  20.                     app.toast(data.msg);
  21.                 }
  22.                 var url = "{{path('app_backend_productioncompany_editproductions', {idProduction: '_idProduction'})}}";
  23.                 url = url.replace("_idProduction", data.idProduction);
  24.                 window.location.assign(url);
  25.                 
  26.             }
  27.         });
  28.     }
  29.     function deleteProduction(idProduction){
  30.         $.ajax({
  31.             url: "{{ path('app_backend_productioncompany_productiondelete') }}",
  32.             data: {'idProduction':idProduction},
  33.             type: "POST",
  34.             cache: false,
  35.             error: function (err) {
  36.                 if (data.response == 'error') {
  37.                     app.toast(data.msg);
  38.                 }
  39.             },
  40.             success: function (data) {
  41.                 if (data.response == 'success') {
  42.                     app.toast(data.msg);
  43.                 }
  44.                 location.reload();
  45.                 
  46.             }
  47.         });
  48.     }
  49. </script>