Saved easyUI datagrid ajax asynchronous data saved data caused no echo

easyUI datagrid needs to be preserved for editing data to the database after editing is complete, click on the top of the "Save" button to update the data to the database and refresh the page.

ajax js used to update the data to the database, and call the Refresh method, reload the datagrid. The Edit saved data is not echoed, refresh the page, you can see just edit the saved data.

 

 Check the code, debugging, no problem, update the data saved to the database.

analyse as below

 

 It concluded that, for the asynchronous ajax default, when the latter ajax code data need to use asynchronous request requires a synchronous manner.

The following is an example, the request succeeds success need to return a result of the background determination, requires the use of synchronization:

// 请求更新
          $.ajax({
              type:"post",
              url:"/bcm/UpdateStatus",
              async:false,
              data: {
                  "spID": spID,
                  "deptFlag": deptFlag,
                  "encodePpapNameStrSplitWithComma": encodePpapNameStrSplitWithComma
              },
              dataType:"json",
              success: function (data) {
                if (data.info.length > 0) {
                    alert(data.info);
                }
              }
            });

 

Guess you like

Origin www.cnblogs.com/alphajuns/p/12410422.html