0

我在 asp.net 应用程序中使用带有 jquery 的 JSON 对象。该代码适用于 VS2008,但是当我在 VS2003 中移动 sam 代码时,它显示 JSON 未定义。代码如下

var mes = $('#filePath').val();
alert("File Path: " + mes);
var jsonText = JSON.stringify({ sFilePath: mes });

在第三行它给出了错误:Microsoft JScript 运行时错误:'JSON' is undefined

任何人都可以帮助解决这个问题。我需要添加任何参考。

在此先感谢 Eshwer N

4

1 回答 1

3

这闻起来不像是 ASP.NET 问题。而是尝试将 json2.js 作为脚本标签的一部分 -

http://www.json.org/

https://github.com/douglascrockford/JSON-js

http://www.json.org/js.html

<script src="http://wherever.com/json2.min.js" type="text/javascript"></script>
于 2012-04-30T13:30:49.093 回答