Ajax Call using jQuery in HTML

This is the example to how to do Ajax call to read message in HTML using JQuery.

<script language="javascript" type="text/javascript">  

        function ReadMessageCall() {

        var pageUrl = '<%=ResolveUrl("~/WebService/Webservice1.asmx")%>'

        $.ajax({

            type: "POST",

            url: pageUrl + "/ReadMessage",

            data: "{'mail':'" + $('#<%=txtemail.ClientID%>').val() + "'}",

            contentType: "application/json; charset=utf-8",

            dataType: "json",

            success: OnSuccess,

            error: OnError

        });

    }

    function OnSuccess(response) {

        $('#<%=lblMessage.ClientID%>').html(response.d);

    }

    function OnError(response) {

        alert(response.status + " " + response.statusText);

    }  

</script>