chobo2
chobo2

Reputation: 85795

Can jquery.json.js and Json2.js be used at the same time?

I am looking at an application someone else made and it was made using "jquery.json.js" plugin.

However I get errors like this in IE 7

SCRIPT5009: 'JSON' is undefined

This lead me to posts like json is undefined what say to use json2.js.

I added this script and it does solve my problem. I am however wondering if these 2 scripts could conflict.

jquery.json.js seems to be a port of json2 from what I read but it does not obvisouly have IE 7 support.

jquery.json.js also seems to have extra methods as when I remove it and just use json2 I get a whole bunch of errors as the app is dependent on some methods from jquery.json.js such as $.secureEvalJSON is not a function

Upvotes: 1

Views: 447

Answers (1)

zgood
zgood

Reputation: 12581

Yes they can and should. json2.js just creates a global JSON object that is available natively on most modern browser except IE7. Import json2.js FIRST because your other scripts needs the JSON object.

Upvotes: 2

Related Questions