javascript - How to redefine js parameters externally
巴扎黑
巴扎黑 2017-06-28 09:26:40
0
2
661

How to redefine the data parameter in the js file externally?

digg: function(obj, projId, subjId, optId) {
    data = {
        'answer': JSON.stringify(answer),
        'login': 1,
        'source': 1,
        'g_tk': generateToken(getKey()),
        'format': 'script',
        'callback': 'parent.AppPlatform.Survey.Digg.ReceiveDiggResult'
    }
}
巴扎黑
巴扎黑

reply all(2)
过去多啦不再A梦
data = {
        'answer': 'answer',
        'login': 1,
        'source': 1,
        'g_tk': 'g_tk',
        'format': 'script',
        'callback': function(){}
}

就可以了,data没有写var。会绑在外面的
漂亮男人
digg: function(obj, projId, subjId, optId) {
    data = {
        'answer': JSON.stringify(answer),
        'login': 1,
        'source': 1,
        'g_tk': generateToken(getKey()),
        'format': 'script',
        'callback': 'parent.AppPlatform.Survey.Digg.ReceiveDiggResult'
    };
}

data = {};

That’s it. The scope of data within the function is only valid inside the function, so redefining data outside the function does not affect the operation of data inside the function at all.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template