Microsoft JScript运行时错误:'JSON'未定义 [英] Microsoft JScript runtime error: 'JSON' is undefined
问题描述
以下是我项目中使用的脚本。
Below is the script used in my project.
$.ajax( {
type:'Get',
url: 'SOEDefaultB2.aspx/GetData2',
dataType: 'text',
data: JSON.stringify({routeById: routeById, mA: mA, mB: mB}),
contentType: 'application/json; charset=utf-8',
crossDomain : true,
success:function(results) {
console.log('Success!');
debugger;
ajaxData = results; },
error: function(xhr, status, error) {
debugger; console.log(error); }
});
我收到Microsoft JScript运行时错误:'JSON'未定义,因为我添加了
I received Microsoft JScript runtime error: 'JSON' is undefined as I added
data: JSON.stringify({routeById: routeById, mA: mA, mB: mB}),
然后我添加了
Then I added
<script src="Scripts/JSON2.js" type="text/javascript"></script>
,来自 https://github.com/douglascrockford /JSON-js/blob/master/json2.js [ ^ ],错误功能显示内部服务错误。
有关调试的提示吗?谢谢。
, which was sourced from https://github.com/douglascrockford/JSON-js/blob/master/json2.js[^], the error function shows 'Internal Service Error'.
Any hint for the debugging? Thanks.
推荐答案
.ajax({
type:' 获取',
url:' SOEDefaultB2.aspx / GetData2',
dataType:' text',
data: JSON .stringify({routeById:routeById,mA:mA,mB:mB}),
contentType:' application / json; charset = utf-8',
crossDomain: true ,
成功: function (结果){
console .log(' 成功!');
调试器;
ajaxData = results;},
错误:功能(xhr,status,error){
debugger ; console .log(错误); }
});
.ajax( { type:'Get', url: 'SOEDefaultB2.aspx/GetData2', dataType: 'text', data: JSON.stringify({routeById: routeById, mA: mA, mB: mB}), contentType: 'application/json; charset=utf-8', crossDomain : true, success:function(results) { console.log('Success!'); debugger; ajaxData = results; }, error: function(xhr, status, error) { debugger; console.log(error); } });
我收到Microsoft JScript运行时错误:'JSON'未定义,因为我添加了
I received Microsoft JScript runtime error: 'JSON' is undefined as I added
data: JSON.stringify({routeById: routeById, mA: mA, mB: mB}),
然后我添加了
Then I added
<script src="Scripts/JSON2.js" type="text/javascript"></script>
,来自 https://github.com/douglascrockford /JSON-js/blob/master/json2.js [ ^ ],错误功能显示内部服务错误。
有关调试的提示吗?谢谢。
, which was sourced from https://github.com/douglascrockford/JSON-js/blob/master/json2.js[^], the error function shows 'Internal Service Error'.
Any hint for the debugging? Thanks.
如果添加了JSON2.js,错误:'JSON'未定义就消失了。但是存在内部服务器错误,这将在另一个线程中讨论。
If added JSON2.js, the error: 'JSON' is undefined was gone. But the Internal Server Error exists, which is to be discussed in another thread.
这篇关于Microsoft JScript运行时错误:'JSON'未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!