I will not introduce Jquery UI Dialog, but some of the attributes can be found here:
As for what files need to be introduced, I will not mention it. Give a Website: http://www.cnblogs.com/haogj/archive/2011/02/16/1956267.html (I'm really lazy .)
I am focused on the problem of submitting the Form of Dialog.
I don't know how to use Dialog. Let me talk about the method.
[Html]
<Div id = "dialog">
<Form id = "dialogForm" method = "post" action = "user/add">
<Table>
<Tr>
<Td> name: </td>
<Td>
<Input type = "text" name = "name"/>
</Td>
</Tr>
<Tr>
<Td> Age: </td>
<Td>
<Input type = "text" name = "age"/>
</Td>
</Tr>
</Table>
</Form>
</Div>
[Javascript]
$ ("# Dialog"). dialog ({
Modal: true,
AutoOpen: false,
Buttons :{
"OK": function (){
Var form = $ ("# dialogForm ");
$. Ajax ({
Url: form. attr ('action '),
Type: form. attr ('method '),
Data: form. serialize (),
DataType: "json ",
Success: function (data ){
$ ("# Dialog"). dialog ("close ");
Alert ("succeeded ");
},
Error: function (){
$ ("# Dialog"). dialog ("close ");
Alert ("error occurred ");
}
}
},
"Close": function (){
$ ("# Dialog"). dialog ("close ");
}
}
});
In this way, you can directly write the form in the div. Then form. serialize () gets all the data. It's easy.
I have been entangled in this issue for a long time. It is inconvenient and not practical to look at foreign websites. I will find it myself.
If you have any questions, please leave a message.