Skip to content Skip to sidebar Skip to footer

Cannot Invoke Ashx Inside The Function

I am having jquery code to invoke ashx file. Its perfectly working while page load. When i call the function from another function means not working.I have place the two codes here

Solution 1:

I think you are missing the proper jquery syntax . Try the following modified code :-

<script type="text/javascript">
    $(document).ready(function () {

        try {
            $("#submit").click(function () {

                var user = $("#login").val();
                var pass = $("#password").val();                    
                CallLoginHandler(user, pass);
            });

        } catch (ex) {

        }

    });


    function CallLoginHandler(user, pass) {
        $.ajax({
            type: "POST",
            url: "../handler/JQGridHandler.ashx?MainPage=GetUserDetails&Type=2&user=" + user + "&pass=" + pass + "",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (response) {
                if (response.length > 0) {

                    alert(response[0]["FLD_ID"]);
                    //successCallback(response);
                } else {
                    alert(response[0]["FLD_ID"]);
                }
            }
        });

    }

</script>

Post a Comment for "Cannot Invoke Ashx Inside The Function"