【问题标题】:error Parse.json on windows OSWindows 操作系统上的错误 Parse.json
【发布时间】:2010-11-18 09:51:08
【问题描述】:

我在使用 jquery 的 windows os 上遇到 json 问题:

我这样做:

    $('person_select').selectChain({
            target: $('#closet_select'),
            url: function(value){
                return 'http://project.dev/person/' + value + '/closets.json';
            }
        });

#person_select 是一个选择字段

在我的控制器中,我这样做了:

format.json { render :json => @closets.map { |c| { :id  => c.id, :label => c.first_name} } }

并且返回的值进入目标(#closet_select)。

这在我使用 mac 时效果很好,但在 windows 操作系统上它会在 jQuery 文件中引发错误:

data = window.JSON.parse( data );

如果有人知道问题是什么,我也很高兴知道它^^ 谢谢

【问题讨论】:

  • jQuery 的哪个版本?

标签: jquery ruby-on-rails windows json


【解决方案1】:

当您使用窗口对象的 JSON 属性时,这不取决于 jQuery 或操作系统,它取决于 window.JSON 的浏览器实现。那么您使用哪种浏览器,如果您使用 MSIE,您是否在兼容模式下使用它?

【讨论】:

  • 当我在 Mac 上时它适用于所有浏览器(IE、firefox、safari、chrome),但当我在 Windows 上时它从不工作,它与项目的版本完全相同两个操作系统
猜你喜欢
  • 2018-09-19
  • 1970-01-01
  • 1970-01-01
  • 2023-03-22
  • 1970-01-01
  • 2023-04-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多