Spotify Apps和jQuery

use*_*795 1 api jquery spotify

如何在Spotify应用程序中添加和使用jQuery(使用Spotify Apps API)?

关于这篇文章http://docs.jquery.com/Using_jQuery_with_Other_Libraries我在我的Spotify应用程序中试过这个:

<body onload="sp = getSpotifyApi(1); j = sp.require('jquery'); tutorial = sp.require('tutorial'); tutorial.init();">
Run Code Online (Sandbox Code Playgroud)

然后 :

var $j = j.jQuery.noConflict();
$j("h2").text("ddd");
Run Code Online (Sandbox Code Playgroud)

但它不起作用......

Man*_*ijn 8

为什么不在里面添加jQuery.js文件head

所以,如果您参加教程http://developer.spotify.com/download/spotify-apps-api/tutorial/,它将改为

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>My First App</title>
    <link rel="stylesheet" href="sp://import/css/adam.css">
    <link rel="stylesheet" href="tutorial.css">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
</head>
<body>
<h1 id="header">Hello, world!</h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

  • 如果您将[http://ajax.googleapis.com](http://ajax.googleapis.com)添加到清单中的RequiredPermissions,则此方法有效. (4认同)