0

I am making an AJAX calling using JQuery. I get back a JSON object containing HTML and Javascript. Within the javascript, there is a function Initialize(). This returned javascript from the AJAX call should replace the initial definition of Initialize() which was there before the AJAX call was made. So basically, I'm trying to dynamically change the code of the javascript function to code I get back from an AJAX call. Help? Thanks in advance.

1
  • 1
    What is your question? Did you try something and it didn't work? Commented Oct 26, 2009 at 16:50

1 Answer 1

0

I think you might be looking for something like this:

init = function() { alert("init"); };

hash = { "newInit" : function() { alert("newInit"); }};

init(); // alerts "init"

init = hash.newInit;

init(); // alerts "newInit"
Sign up to request clarification or add additional context in comments.

1 Comment

Ah...function pointers. Don't know why I didn't think of that :D Yes, this definitely helps. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.