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);
});
精彩评论