954,180 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

On Function Call

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

samarudge
Posting Whiz
359 posts since May 2008
Reputation Points: 26
Solved Threads: 31
 

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

fatihpiristine
Posting Whiz in Training
283 posts since Sep 2007
Reputation Points: 6
Solved Threads: 19
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You