Hi all!
I have a plugin (same as links but with many changes) and, when onOk is called check, if data.type is a popup call an ajax and, with the response call _onOk (_onOk is the original onOk). This don't work because _onOk is no declared (I think that is because the context).
How I can make a call to a function in the dialog from a ajax response?
This ajax give to the onOk funtion an ID.
I renamed onOk to _onOk because in the (new) onOk I call the ajax to add some data in the DB and return the ID of this data. When this ID I need to add a link.
Hope understand and help me.
Regards Juan Pablo
Sorry for my English
I have a plugin (same as links but with many changes) and, when onOk is called check, if data.type is a popup call an ajax and, with the response call _onOk (_onOk is the original onOk). This don't work because _onOk is no declared (I think that is because the context).
How I can make a call to a function in the dialog from a ajax response?
This ajax give to the onOk funtion an ID.
I renamed onOk to _onOk because in the (new) onOk I call the ajax to add some data in the DB and return the ID of this data. When this ID I need to add a link.
Hope understand and help me.
Regards Juan Pablo
Sorry for my English

Re: [Dialog/Plugin] - Call onOk from ajax
Re: [Dialog/Plugin] - Call onOk from ajax
(data is the ajax response text)
But many things needed to create the link can't be initialiced by CKEDITOR.
var attributes = { href : '#', onclick: 'return false;'}, removeAttributes = [], data = { href : attributes.href }, me = this, editor = this.getParentEditor();I think even though I call it through CKEDITOR.dialog.getCurrent(), lost the context.
My code is:
onOk : function() { var //attributes = { href : 'javascript:void(0)/*' + CKEDITOR.tools.getNextNumber() + '*/' }, attributes = { href : '#', onclick: 'return false;'}, removeAttributes = [], data = { href : attributes.href }, me = this, editor = this.getParentEditor(); this.commitContent( data ); if (data.type != 'popup') _onOk(); else { $.post('ajaxEditComment.jsp', { action:'add', comment:data.popup_text, name:data.popup_title }, function(d){ CKEDITOR.dialog.getCurrent().definition._onOk(d); }, 'html'); return false; } }, _onOk : function(id) { var //attributes = { href : 'javascript:void(0)/*' + CKEDITOR.tools.getNextNumber() + '*/' }, attributes = { href : '#', onclick: 'return false;'}, removeAttributes = [], data = { href : attributes.href }, me = this, editor = this.getParentEditor(); alert(data.type); // Compose the URL. switch ( data.type ) { case 'taxonomy': attributes.taxonomy_id = data.taxonomy_id; break; case 'refs': attributes.element_link_id = getSelectedReference(); break; case 'popup': attributes.popup_id = id; break; } ... MUCH MORE STUFF ...and the error is:
Hope help me.
Regards Juan Pablo