开发者

Dynamically changing javascript variable

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.


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"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜