Laravel 5: Update record using jQuery & ajax

The View

Your view (probably your index.blade) should contain the following:

  • the list of records from your index function in controller, in my case I populate it with using foreach loop
  • you should have an edit button that will have the record $office->id as value, and you should have ID or class in order for the script to identify. (I have used¬† btn-edit here).
  • You should have a hidden form of which you will be showing once the edit button is clicked.
  • Your inputs and other control should have ID, better if the ID is same as your table’s field name.

Sharing is caring!