search

Home  >  Q&A  >  body text

javascript - How to redefine js parameters externally

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'
    }
}
巴扎黑巴扎黑2774 days ago671

reply all(2)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-06-28 09:28:40

    data = {
            'answer': 'answer',
            'login': 1,
            'source': 1,
            'g_tk': 'g_tk',
            'format': 'script',
            'callback': function(){}
    }
    
    就可以了,data没有写var。会绑在外面的

    reply
    0
  • 漂亮男人

    漂亮男人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.

    reply
    0
  • Cancelreply