I am trying to make c# function call from jquery by using following codes. But I only get Internal server error. Please help me to find out why and how I have to fix it. Thank you.
Script
<script type="text/javascript">
$(function () {
$(".matrix_tableActive").click(function (e) {
alert(e.target.id);
$.ajax({
type: "POST",
url: "Default.aspx/Download",
data: JSON.stringify({ sth: "hahaha" }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: fnsuccesscallback,
error: fnerrorcallback
});
});
function fnsuccesscallback(data) {
alert(data.d);
}
function fnerrorcallback(result) {
alert(result.statusText);
}
});
</script>
C#
[WebMethod]
protected static String Download(String sth)
{
return sth;
}