Save Local Data Array Back to Server via Ajax

Below is the code snippet to submit local array back to server through Ajax POST. jQuery Form plugin is required. Users must supply their own server-side save routine URL e.g. "save_local_array.php". The edit.php provided with phpGrid only works with database data source. 

    <script src=""></script>
    <form id="admin_form">
            <input type="submit" value="Submit Local Changes">

        $(function() {
            // bind to the form's submit event
            $('#admin_form').submit(function(event) {
                    type: 'post',
                        langArray:[] //leave as empty array here
                    beforeSubmit: function(arr, $form, options){
                        options.langArray = $('#data1').jqGrid('getRowData'); //current
                        // return false; // here to prevent submit
                    success: function(){
                        // add routine here when success

                // return false to prevent normal browser submit and page navigation
                return false;

The data format posted back to the server is JSON format. 

Visit and select "Local Array" demo, enable browser console, and the hit "Submit local changes" button, you should see a sample of the JSON data similar to the below posted back to the server.  


Datagrid Edit

  1. Constant value in create/edit form
  2. Display column in grid but hide when edit
  3. inline editing limited to single cell
  4. Get value from a specific cell from selected row
  5. phpGrid insert error - Need to hide primary key during edit
  6. Unable to edit
  7. Use arrow key to navigate a grid
  8. WYSIWYG doesn't work
  9. Editable Datagrid with Add Only Ability
  10. Change edit properties without modifying the source code
  11. Auto Increment (auto-increment) Field validation Due to Underscore Character in Primary Key
  12. Display server error message during edit
  13. CRUD (Create, Remove, Update, Delete) Not Working
  14. Dropdown Concatenation
  15. How to preserve a value of NULL as on update as it is being set to 0
  16. Cannot save or edit records. How to debug?
  17. Show a column as link based on value of another column
  18. Verify uniqueness of a new value entered when edited or added through phpGrid before saving
  19. Soft-delete record by flagging a value (Flag for delete)
  20. Must fill every fields to save, or nothing gets saved!
  21. Displaying TIMESTAMP Fields in an Editable Grid
  22. Datetime Format
  23. Create edit type "select" options manually from SQL query
  24. Access local array data source
  25. How to Obtain Entire Datagrid Data as an Array?
  26. Center Add/Edit Form
  27. Save stored value in PHP Session when inserting
  28. Save Local Data Array Back to Server via Ajax
  29. How to set the "select" col_edittype be readonly?
  30. Dynamic dropdown based on cell value in a row.
  31. How to Increase Size of Multiple Select in Edit Form
  32. Save Data in Calculated/Virtual Column to Database
  33. Sorting columns with Key-Value pairs when edit type is "select"
  34. Sorting columns with Key-Value pairs when edit type is "select"
  35. Week start on Monday
  36. How to grab the table rows in a grid
  37. How to view Sql generated during CRUD?
  38. How to show remaining characters in a field on the edit form?
  39. Use Inner Join
  40. Custom button in action column
  41. Edit Grid of a JOIN or a complex query
  42. Help! I still cannot get Nested Dropdown to work
  43. How do I make lookup fields (id fields referencing to other table) make dropdown from other table?
  44. Capture time stamp on submit
  45. Sample code to save local array back to database with custom edit script
  46. How to Create a Confirm Dialog Box Before Submit a Change?
  47. CELL edit with add and delete buttons
  48. Notification "saved successful" but doesn't create new record
  49. How to avoid error "Please enter a valid data type ..." when leaving the field blank
  50. Delete Callback - Delete some Files when record is deleted from a table
  51. Remove the associated files after deleting a row
  52. Update column based on the changed value of another column
  53. How to apply MD5 or SHA2 to a field
  54. Browser Autofill interference
  55. Record when a recored is created and updated using Timestamp
  56. Update subtotal after copy row
  57. How to get a selected row data in grid populated via local array source
  58. Set default value during Edit

Feedback and Knowledge Base