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'
}
}
过去多啦不再A梦2017-06-28 09:28:40
data = {
'answer': 'answer',
'login': 1,
'source': 1,
'g_tk': 'g_tk',
'format': 'script',
'callback': function(){}
}
就可以了,data没有写var。会绑在外面的
漂亮男人2017-06-28 09:28:40
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.