javascript - Mootools JSON(拉取顶级项目)

标签 javascript json mootools

尝试从我的 json 请求中提取所有“标题”,但没有成功。

当前 fiddle = http://jsfiddle.net/DZkZV/

当前 Json:

    {
      "title": "Title 1"
    },
    {
      "title": "Title 2"
    },
    {
      "title": "Title 3"
    },
    {
      "title": "Title 4"
    }

当前的 Javascript:

var addTopTopItemsLi = function(title){
  title.each(function(){
    var el = new Element('li'),
             htmltxt = new Element('span', {'class': 'pgTitle','html': title.title}).inject(name);
             inject(gallery);
  });

};

最佳答案

你现在有点仓促行事了,不是吗:)

http://jsfiddle.net/dimitar/DZkZV/1/

要点: - json 需要是一个项目数组。 - 你必须传递整个响应然后循环它。 - .each 循环中的异常和不一致的引用。

附注新的 firebug 1.8.3 太差了,在 ajax 之后无法显示内部异常,真令人沮丧……

关于javascript - Mootools JSON(拉取顶级项目),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7803298/

相关文章:

javascript - React 中的视差滚动

javascript - javascript跨域请求xml的方法

javascript - 为什么对象原型(prototype)显示为 html 属性?

javascript - MooTools:父对象调用子方法

javascript - 在鼠标悬停时调整图像大小 (Javascript/MooTools)

javascript - 为什么这个javascript在IE中不起作用,但在其他浏览器中却起作用?

javascript - svg 动画从动态值转换

java - 如何在 Firebase 中仅获取子 key

android - 无法在 SwipeFlingAdapterView 中显示项目

python - AttributeError 'list' 对象没有属性 'get'