943,175 Members | Top Members by Rank

Ad:
Aug 31st, 2010
0

On Function Call

Expand Post »
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
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. function open_dynload() {
  2. //Function
  3. adm_linkify();
  4. }
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
Similar Threads
Reputation Points: 26
Solved Threads: 31
Posting Whiz
samarudge is offline Offline
354 posts
since May 2008
Sep 1st, 2010
0
Re: On Function Call
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
Reputation Points: 6
Solved Threads: 19
Posting Whiz in Training
fatihpiristine is offline Offline
283 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: JavaScript Change hidden field a number of times
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Loading Page in Specific Div using AHAH - http://microformats.org/wiki/rest/ahah





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC