This article introduces how to call the close () function when using JQuery ui dialog. If you encounter such problems, refer to it.
The problem is as follows:
At first I used floatLayer. show pops up A layer and loads A form through ajax (in place of Form A below). When the form is loaded, I initialize JQuery ui dialog in the form, and configure some parameters.
Code:
The Code is as follows: |
Copy code |
$ (Function () { // Initialization parameters $ ("# Getcompany"). dialog ({autoOpen: false, width: 760, height: $ companyselectboxheight, closeOnEscape: false }); }
|
In this case, I call to open:
The Code is as follows: |
Copy code |
// Open $ ("# Getcompany"). dialog ('open '); Or close // Close $ ("# Getcompany"). dialog ('close '); |
Everything works.
However, it is normal for me to close form A and call the preceding method to Open Form.
The final solution is to change the object $ ("# getcompany") to a global variable.
For example:
The Code is as follows: |
Copy code |
$ (Function () { // Initialization parameters GETCOMPANY = $ ("# getcompany "); GETCOMPANY. dialog ({autoOpen: false, width: 760, height: $ companyselectboxheight, closeOnEscape: false }); } // Open GETCOMPANY. dialog ('open '); // Close GETCOMPANY. dialog ('close ');
|
So there is no problem. Pai_^
Note: you cannot add var before GETCOMPANY initialization, that is, you cannot write var GETCOMPANY =$ ("# getcompany ");