I also modified the original modal.js script to support ajax content and added a new behavior called "ajax", here is my code snippet:
ajax: function(callback) {
callback = $.isFunction(callback)
? callback
: function(){}
;
var $content = $(this).find('.content');
$.get("contentData.php", function(data) {
$content.html(data);
});
And I call it that:
$('body').on('click', '.domOdal', function() {
$('.ui.modal')
.modal({
observeChanges: true
}).modal('ajax')
});
The above code works perfectly and loads the content correlation, but I would like to expand it, so I can add additional information like user url, dataType etc. almost all ajax parameters, and I would like to do that from the initialization part, for example:
$('body').on('click', '.domOdal', function() {
$('.ui.modal')
.modal({
observeChanges: true
}).modal('ajax', {"id":5}, dataType:"json", "url": http:
});
source
share