Use jQuery to insert multiple data into the modal box. jquery Mode
Copy codeThe Code is as follows:
// Bootstrap modal box (partial)
<Div class = "modal fade" id = "orderDetail">
<Div class = "modal-dialog">
<Div class = "modal-content">
<Div class = "modal-header">
</Div>
<Div class = "modal-body">
<Table class = "table">
<Tr>
<Td> name </td>
<Td> original price </td>
</Tr>
</Table>
</Div>
<Div class = "modal-footer">
</Div>
</Div>
</Div>
Copy codeThe Code is as follows:
/**
* View data details
* @ Blackeye poet <www. chenwei. ws>
*/
Function orderDetail (order_no)
{
// 1. Clear the modal box data first
$ ('# OrderDetail'). find ('tr '). first (). nextAll (). remove ();
// 2. Insert externally
Var order_no = order_no;
$. Post (base_url + '? D = admin & c = orders & m = ajax_order_detail ', {order_no: order_no}, function (data ){
// Data format: [{no: 123, old: abc}, {no: 234, old: def}, {no: 345, old: ghi}]
Var obj = eval ('+ data + ')');
$. Each (obj, function (I, n ){
Var tr = $ ('# orderDetail'). find ('tr '). last ();
Tr. after ("<tr> <td>" + n ['organize _ name'] + ": "+ n ['cate _ name'] +" -- "+ n ['course _ name'] +" </td> <td> "+ n ['old _ price '] + "</td> <td>" + n ['sale _ price'] + "</td> </tr> ");
});
});
}
I want to have a DIV layer that contains pre-configured text. After clicking it, it is automatically inserted into the text box. How can I use JQUERY to do this? I want all the code
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ("# Div id"). click (function (){
Var val = require (this).html (); // obtain the text in the div
$ ("# Textarea"). val (); // put the text in the div into textarea
});
});
</Script>
// Textarea for displaying div text
<Textarea id = "textarea"> </textarea>
See if you want
Can jquery code be inserted in html to achieve the same work as jsp?
AJAX is only a function of JAVASCRIPT. JQUERY is a JAVASCRIPT encapsulation class with simplified AJAX operations.
AJAX uses the javascript dom tree to operate HTML documents by asynchronously interacting with the background and returning values in the background...
The interaction with the background is equivalent to the content displayed on the JSP page accessed by the URL of your browser, but JAVASCRIPT runs through asynchronous access.