the-modal icon indicating copy to clipboard operation
the-modal copied to clipboard

$.get is not opening content in specified #id modal div

Open AnghelGabriel opened this issue 9 years ago • 6 comments

                $('#modal-window').modal({ 
                    lockClass: 'modal-lock',
                    overlayClass: 'modal-overlay',
                    closeOnEsc: false,
                    closeOnOverlayClick: false,    
                    onBeforeClose: null,
                    onClose: null, 
                    onOpen: function(el, options){
                        $.get('http://'+siteroot+modalPath+modalContent+'.php', function(data){
                            el.html(data);  
                        }); 
                    },
                    cloning: true
                }).open();

I'm using this. But when it openes the php file it just dumps the content in "modal-overlay" div. Am i missing something here?

AnghelGabriel avatar Sep 10 '15 13:09 AnghelGabriel

check the content that returns by your url. it should be partial html, without

etc.

maxxi165 avatar May 20 '17 10:05 maxxi165

На самом деле, проблема имеет место быть. Сам наступил на эти грабли. Скорей всего дело в несоответствующей документации, которая вводит в заблуждение.

Берем пример из документации

$.modal().open({
	onOpen: function(el, options){
		el.html('Hello!');
	}
});

ожидаем, что откроется модал с надписью Hello. Написано же "You can use it w/o markup at all by opening empty modal and filling it with custom data the way you want (see below)." Но фигвам! Затеняется оверлей и на его фоне пишется "Hello". Получается, "w/o markup" уже не работает?

maxxi165 avatar May 20 '17 22:05 maxxi165

В первоначальной версии в onOpen передавался элемент диалога, а потом стали передавать элемент оверлея.

maxxi165 avatar May 22 '17 11:05 maxxi165

Хм... с какого коммита?

samdark avatar May 22 '17 11:05 samdark

наверное это https://github.com/samdark/the-modal/commit/434530e26d187581493a7466df0e1f21a12dc4df /* как правильно вставлять ссылку на коммит? */

maxxi165 avatar May 22 '17 11:05 maxxi165

Да, похоже. Доку надо поправить, но времени сейчас в обрез :( Если сделаете pull request — с удовольствием смёржу.

samdark avatar May 22 '17 12:05 samdark