I have a function like: uiModal.simpleModal('<p>This is some content</p>');
Which should call a modal with the passed data as the modal content. e.g. (note I haven't added the modalHtml as it's not relevant to this question).
simpleModal: function (data) {
var responseHtml = data;
// Append the modal HTML to the DOM
var modalInstance = $('body').append(modalHtml);
// Dynamically load in the passed data from the call
$.ajax({
timeout: 5000,
success: function (responseHtml) {
$(modalInstance).find('.uiModalContent').html($(responseHtml));
$(modalInstance).find('.uiModalContent').removeClass('loading');
isModalSuccess = true;
},
error: function () {
$(modalInstance).find('.uiModalContent').html('<div class="message error"><h2>Unknown Error</h2> Please contact support</p></div>');
$(modalInstance).find('.uiModalContent').removeClass('loading');
}
});
$(modalInstance).find('.ModalClose').live('click', function (e) {
e.preventDefault();
$(this).parents('.uiModal').fadeOut(function () { $(this).parents('.uiModalWrapper').remove() });
});
},
However it doesn't load in the data! Can someone point me in the right direction
Thanks