2014-05-06 22 views
-2

嗨,我想创建一个API混搭,从谷歌地图和flikr API拉动,但不断收到此错误在$调试未在此行中定义..

$(document).ready(function(){ 

//Connects to the Flickr API and reads the results of the query into a JSON array. This query uses the 'flickr.photos.search' method to search for photos with the tag 'crafts'. It passes the resultant JSON array to the 'displayImages3' function below. 
$.getJSON("https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=df0277b8fff85c5ae122dc218d10e80e&tags=crafts&safe_search=1&has_geo=1&extras=geo&format=json&nojsoncallback=1&auth_token=72157644134169448-3a5eafa7a9912070&api_sig=230ed5707e01cfe061939756fe6107d4", displayImages3); 

它提出了一个愚蠢的问题,但我如何定义这个?

+0

你加载jQuery库?这是JS代码中'$'的常用来源。 –

+0

您是否在代码中添加了jQuery库? –

+0

对不起,是的,它是连接好,谢谢,那里有上调试没有错误了,但它仍然不会在来自Flickr的图片拉,鳕鱼有错误说法参照实体“api_sig”对于没有系统标识符可能是生成 – user3561656

回答

3

您需要包含jQuery。要做到这一点,这一行添加到您的HTML的head

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> 

符号$看起来像一个关键字,但它实际上是那个来自包括jQuery库变量名。许多JavaScript教程都是在假设这个库已经被导入的情况下编写的。你可以阅读有关jQuery的位置:http://jquery.com/

1

$是jQuery的 - 你的jQuery导入到你的应用程序/页,这些行之前,正在运行?看到这个问题为好,它通过确保您的jQuery是在正确的位置加载的逻辑走:JQuery - $ is not defined

相关问题