Detailed explanation of both MOTSTRAP MODAL-REMOTE two loading methods [strengthen]



 open     
When you click on the connection, the content of DEMO.JSP can be dynamically loaded into

. Of course, the connection here can also be Controller


Method 2:



$ (“#mymodal”). Modal ({remote: “page.jsp”});
  But then after loading, there will be problems, and Modal data is only loaded once. If you want to load different data, for example according to ID query details, MODAL data cannot be updated, even if the passing ID value is different. In fact, the solution is simple, just need to clean the previous load before loading the next data.  
The simplest way is to listen to MODAL’s Hidden. When MODAL is turned off, it can be cleared:


/ / v2 $ (“# mymodal”). On (“Hidden”, function () {$ (this) .removedata (“MODAL”);}); // v3 $ (“# mymodal”). on (“Hidden .bs.Modal, Function () {$ (this) .removedata (“bs.modal”);});

If the problem is in the request There are $ () load events, such as Boostrap-Validator or Boostrap-File.Input and other plugins will appear strange phenomena. The first normal execution, turn off the modal, the second, $ () code is not executed, the third time can be executed; after repeated discovery “Hidden.Modal” monitor each time It is implemented, but the data contained in
  is not cleared, which may be caused by this reason, so it is changed to the following code:  

$ (“# mymodal”). On (“Hidden.bs.Modal”, Function () {$ (this) .removeData (“bs.modal”); / * MODAL page load $ () error, Due to the removal cache is loaded to

Unremnible data, manually remove the loaded content * / $ (this) .find (“. Modal-content”). Children ( ) .Remove ();});

So problem solved!
  The above is all the content of this article, I hope to help everyone, I hope everyone will support Tumi Cloud.  
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment