Hey,
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() {
//Function
adm_linkify();
}

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.

-Sam

Member Avatar for fatihpiristine

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

on success:

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

callback(callbackargs);
}

hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.