English 中文(简体)
宇宙航空研究开发机构向C#方法发出的呼吁没有归还数据。
原标题:AJAX call to C# method is not returning the data
  • 时间:2012-01-12 16:08:39
  •  标签:
  • c#
  • jquery

我指的是以下C#方法:

[WebMethod(true)]
public static List<ReadUserStructure> LoadFriends()
{        
    List<ReadUserStructure> returner = Friend.ReadAllFriends();        
    return returner;
}

The following jQuery:

$.ajax({
    type: "POST",
    url: "Main.aspx/LoadFriends",
    data: "{}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (msg) { alert(msg.Count.toString()); }
});

我在C#方法上有一个突破点,它击中了它。 通过这一方法,该功能进行细微的工作,在我的用户中,编制一个清单,列出2个。 但是,如果这份名单没有归还给客户的话。 任何想法?

最佳回答

问题在于,选票上标有一片牛肉。 相反,参看<条码>。

问题回答

Put a debugger before alert, debug in firebug or IE or Visionroom. 如您收到标的<代码>msg。 如果是使用<代码>msg.Length而不是msg.Count,则添加错误手递和支票错误。

 success: function (msg) {
     debugger; 
     alert(msg.Length.toString()); 
 },
 error: function (data) {
 }

希望这一帮助

或许不可能有序列式的阅读标准?

你们是否看到了神学院监察员或火警的ole果,认为这些事情是正常的。

阅读标准是否可以序列?

询问它是否有你知道应该做的物品清单,如ger或str。

If i am not wrong if you are returning json result you need to mention you are returning a json not sure of the syntax but the server should be specifying i am returning a json result

凡是提到这一问题的序列化的人。 现在,我正在使用我所希望做的非常聪明和容易的阿贾克斯角。

谢谢大家的时间和努力。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签