JavaScript - 内部服务器错误 [英] JavaScript - Internal Server Error

查看:106
本文介绍了JavaScript - 内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此主题类似于无法调用WebMthod的主题带参数 [ ^ ]。相关代码如下:

  var  e =  document  .getElementById('  DropDownRouteID'); 
var routeById = e.options [e.selectedIndex] .text;
var mA = document .getElementById(' MeasureA')。value;
var mB = document .getElementById(' MeasureB')。value;
$ .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
成功:函数(结果){
console .log(' 成功!');
调试器;
ajaxData = results;},
错误: function (xhr,status,error){
调试器; console .log(错误); }
});



  public   static   string  [] [] GetData2( string  route, string  mA, string  mB){
...}



错误中的错误:函数显示内部服务器错误。请提示我可以调试错误的位置。非常感谢。

解决方案

.ajax({
type:' 获取'
url:' SOEDefaultB2.aspx / GetData2'
dataType:' text'
data:< span class =code-sdkkeyword> JSON .stringify({routeById:routeById,mA:mA,mB:mB}),
contentType:' application / json; charset = utf-8'
crossDomain: true
成功: function (结果){
console .log(' 成功!');
调试器 ;
ajaxData = results;},
错误: function (xhr,status,error){
debugger ; console .log(错误); }
});



  public   static   string  [] [] GetData2( string  route, string  mA, string  mB){
...}



错误中的错误:函数显示内部服务器错误。请提示我可以调试错误的位置。非常感谢。


我认为你有循环依赖问题。只需删除循环引用。如果你不能看看:

http://www.asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serialization#handling_circular_object_references [ ^

This thread is similar to the one at Could not call a WebMthod with parameters[^]. The related codes are below:

var e = document.getElementById('DropDownRouteID');
var routeById = e.options[e.selectedIndex].text;
var mA = document.getElementById('MeasureA').value;
var mB = document.getElementById('MeasureB').value;
$.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); }
});


 public static string[][] GetData2(string route, string mA, string mB) {
...  }


The error in the error:function shows 'Internal Server Error'. Please hint me where the error can be debugged. Thanks in adavnce.

解决方案

.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); } });


 public static string[][] GetData2(string route, string mA, string mB) {
...  }


The error in the error:function shows 'Internal Server Error'. Please hint me where the error can be debugged. Thanks in adavnce.


I think you have circular dependencies issue. Simply remove the circular references. If you can not then have a look at:
http://www.asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serialization#handling_circular_object_references[^]


这篇关于JavaScript - 内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆