开发者

jQuery: pass data with $.getScript?

Can i pass data to the function youtu开发者_Go百科beFetchDataCallback in this:

$.getScript( 'gdata.youtube.com/feeds/api/… echo $m; ?>?v=2&alt=json-in-script&callback=youtubeFetchDataCallback' );

e.g i pass data "mode" then inside the function i can alert(mode)


This shows it with an anonymous function; note that the URL is changed to use ? for the callback, so jQuery chooses a function name. However, you can also used a named function in the same scope. Either way, mode is closed in to the function.

var mode = ...;
$.getScript( 'http://gdata.youtube.com/feeds/api/… echo $m; ?>?v=2&alt=json-in-script&callback=?', function()
{
  alert(mode);
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜