简体   繁体   中英

error Parse.json on windows OS

I have a problem with json on windows os with jquery :

I do that :

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

the #person_select is a select field

In my controller, I do that :

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

and the values returned goes in the target (#closet_select).

This works really well when I am on mac but on windows OS it raise an error in the jQuery file :

data = window.JSON.parse( data );

If somebody know what is the problem I would be pleased to know it too ^^ Thanks

As you use the JSON-property of the window-object, this not depends on jQuery or the OS, it depends on the browser-implementation of window.JSON . So which browser do you use, and if you use MSIE, do you use it in compatibility-mode or not?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM