Appending multiple parameters/arguments to a jsonp callback function

前端 未结 3 2183
一向
一向 2020-12-18 14:03

How do I specify more arguments to be passed to a jsonp callback function?

For example, I\'m trying to grab youtube video data:

http://gdata.youtube.         


        
3条回答
  •  臣服心动
    2020-12-18 14:36

    better way is specify an associated array of divId and videoId like this

    var arr = {
        'gzDS-Kfd5XQ': 'divId_1',
        'gwWS-Gasfdw': 'divId_2'
    };
    

    and in callback function get your divId by videoId

    function youtubFeedCallback(data)
    {
        var divId = arr[data.entry.media$group.yt$videoid.$t];
    }
    

提交回复
热议问题