Facebook
From Smelly Anoa, 4 Years ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 163
  1. $(document).on('click','.edit', function(e) {
  2.     const form = {
  3.         id : $(this).data('id')
  4.     }
  5.     save(form, "{{ route('find-address-route') }}", "{{ csrf_token() }}")
  6.     .then((res) => {
  7.    
  8.         $("#method").val('PUT');
  9.        
  10.         //for now i'm using this but only country set selected, other's not.
  11.         $("#country").val(res.data.country)
  12.         $("#state").val(res.data.state)
  13.         $("#city").val(res.data.city)
  14.         $("#district").val(res.data.district)
  15.         $("#sub_district").val(res.data.sub_district)
  16.        
  17.         //show modal
  18.         $("#modalForm").modal('show');
  19.    
  20.      })
  21.     .catch((err) => {
  22.         if(Array.isArray(err.responseJSON.message)){
  23.             err.responseJSON.message.forEach(function(v) {
  24.                 error(v)
  25.             })
  26.         }
  27.         error(err.responseJSON.message)
  28.     })
  29. });