的WebMethod:ASP.NET C#返回未知整數因未知原因
[WebMethod]
public static string[] GetLikes(int Id)
{
List<Like> Likes = Like.GetById(Id, false);
string[] Senders = new string[Likes.Count];
for (int i = 0; i < Likes.Count; i++)
{
Senders[i] = Likes[i].Sender;
}
return Senders;
}
的jQuery:
$(".StreamLike").live("mouseover", function() {
var Id = $(this).parent().parent().find(".StreamIndex").html();
alert(Id);
$.ajax({
type: 'POST',
url: 'Default.aspx/GetLikes',
data: JSON.stringify({ "Id": Id }),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: LikesSuccess,
error: LikesError
});
});
issue img http://www.taaraf.com/issue.png
ID是從JavaScript代碼正確地傳遞爲338。它爲什麼顯示爲152?這不能讓我得到正確的數據。 想法?
.StreamIndex是嵌套在包含Text ='<%#Eval(「Id」)的ListView中的
user1027620