-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathREADME.txt
67 lines (48 loc) · 1.75 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
jquery.loadmodal.js
====================
Author: Conan C. Albrecht <[email protected]>
License: MIT
Dependencies:
- JQuery 1.7+
- Bootstrap 3
A JQuery plugin to open a Bootstrap modal (dialog) with content loaded via Ajax.
Normally, Bootstrap requires that you manually create the dialog <div>s before
loading content into it. This plugin creates the modal divs for you and makes
it easier to call dialogs directly from Javascript without any corresponding
HTML.
Simple example:
$.loadmodal('/your/server/url/');
Advanced example:
$.loadmodal({
url: '/your/server/url',
id: 'my-modal-id',
title: 'My Title',
width: '400px',
closeButton: false,
buttons: {
"OK": function() {
// do something here
// a false return here cancels the automatic closing of the dialog
},
"Cancel": false, // no-op - just having the option makes the dialog close
},
modal: {
keyboard: false,
// any other options from the regular $().modal call (see Bootstrap docs)
},
ajax: {
dataType: 'html',
method: 'GET',
// any other options from the regular $.ajax call (see JQuery docs)
},
}).done(function(data) {
console.log('Ajax response is here!');
}).create(function(event) {
console.log('Modal is created but not yet visible,')
}).show(function(event) {
console.log('Modal is now showing.')
}).close(function(event) {
console.log('Modal just closed!')
});
Closing a dialog: (this is standard bootstrap)
$('#custom_modal_id').modal('hide');