dimanche 10 janvier 2016

Internal server error when jquery call c# function

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: "http://ift.tt/1ZlU8SZ",
                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;
    }




Aucun commentaire:

Enregistrer un commentaire