jQuery parseJSON语法错误ASP.NET

时间:2012-11-12 19:52:14

标签: jquery asp.net json

我正在使用jquery 1.8.2在一个简单的ASP.NET应用程序中进行ajax调用。使用内置的VS Web开发服务器,一切都在localhost上运行罚款。当我把网站放在IIS上时,我得到一般错误:

Message: Syntax error
Line: 514
Char: 4
Code: 0
URI: http://123.123.123.123/Scripts/jquery-1.8.2.js

这是我的电话:

var obj = jQuery.parseJSON(val);

以下是jquery源中该位置的内容:

parseJSON: function( data ) {
if ( !data || typeof data !== "string") {
    return null;
}

// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );

// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
    return window.JSON.parse( data );  <<< LINE 514
}

...(rest of jquery source)

有什么想法吗?就像我说的,在当地工作得很好。

1 个答案:

答案 0 :(得分:0)

Oy,愚蠢的程序员错误。 C是我自己的代码生成的错误消息中的第一个字母。 “未找到组件”。在这种情况下,由于Server Mappath问题,未加载文件。我正在学习的结果是jQuery,JSON,jTemplates等都相对简单。它是开发环境,即ASP.NET和Visual Studio 2010,它们比语言本身更容易使用。非常感谢大家的投入。

相关问题