samedi 16 mai 2020

Update/Edit using Modal form in laravel with Script

I need help to fix my script it can not update the data but it can show , how can i fix that? am i missing a route or something? This is My Modal Form

<form action="/device" method="POST" id="editForm">
      
      

       <div class="col-md-4 mb-3">
       <label>Serial Number</label>
         <input type="text" name="Serial_No" id="Serial_No" class="form-control"  placeholder="Enter Serial number">
       </div>

      <button class="btn btn-primary" type="submit">Add Data</button>
      <button type="reset" class="btn btn-default float-right">Cancel</button>
       <button type="reset" class="btn btn-default float-middle">Clear</button>
    </form>

This is my script

//Start Edit Record
        table.on('click', '.edit', function () {

        $tr = $(this).closest('tr');

        if ($($tr).hasClass('child')) {
          $tr = $tr.prev('.parent');
        }

        var data = table.row($tr).data();
        console.log(data);

        $('#Serial_No').val(data[1]);

        $('#editForm').attr('action', ''+data[0]);
        $('#editModal').modal('show');
        });
        //End Edit Record


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire