On a site I'm developing there is a separate Javascript file loaded when users are logged in as admin, for the sake of this I'll call it admin.js. This file contains a function called adm_linkify(); which adds 'Edit This Content' links to certain elements.

There is also a main Javascript file (main.js) which contains a function called open_dynload();. This function is called to dynamically load a page through Ajax.

When the ajax content loads, the function adm_linkify(); needs to be run (To linkify the new content). The problem is I can't just use

function open_dynload() {

Because the function is not avaliable to standard users.
So my question is, is there something I can do to admin.js WITHOUT changing main.js to basically say
When open_dynload() is called, run adm_linkify()?

If this is not possible, can you do something like
if adm_linkify() is a valid function run adm_linkify();
Which I can put in main.js, I would prefer if it could be done the first way but if it's too complicated then the second method would be OK.


Member Avatar

var q = xmlhttprequest(url, get, false, { callback: func, callbackargs: {} };

on success:

if (typeof callback === 'function') {
if (typeof callbackargs !== 'object' ) { callbackargs = {} ; }


hope this helps