Change d property name of response object in AJAX Success in ASP.Net

Last Reply one year ago By dharmendr

Posted one year ago

i m using two ajax jquery function,each individual calling different method and return value to their respective jquery function.

in Using jQuery 

i have 2 ajax jquery method,which call two indepent different function and return different data.

i m returning data by response.d and response1.d

can i use different word in place of d???

<script type="text/javascript">
    function consultantchat() {
        $(function () {
            debugger;
            var r = document.getElementById("<%=txtmanagerid.ClientID%>").value;
            var s = document.getElementById("<%=txtconsultantid.ClientID%>").value;
            //var r = 2;
            //var s = 13;
            $.ajax({
                type: "POST",
                url: "chat.aspx/GetChatDatas1",
                data: '{managerid: "' + r + '",consultantid:"' + s + '"}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: OnSuccess1,
                //error: function (r) { alert(r.responseText); }
            });
            return false;
        });
        function OnSuccess1(response1) {
            var chatDatas1 = response1.d;
            var row1 = null;
            row1 = $("[id*=grdchat1] tr:last-child").clone(true);

</script>

<script type="text/javascript">
    function clientchat() {
        $(function () {
            debugger;
            var m = document.getElementById("<%=txtmanagerid.ClientID%>").value;
            var n = document.getElementById("<%=txtclientid.ClientID%>").value;
            //var m = 2;
            //var n = 3;
            $.ajax({
                type: "POST",
                url: "chat.aspx/GetChatDatas",
                data: '{managerid: "' + m + '",clientid:"' + n + '"}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: OnSuccess,
                //error: function (r) { alert(r.responseText); }
            });
            return false;
        });
        function OnSuccess(response) {
            var chatDatas = response.d;
            var row = null;
            row = $("[id*=grdchat] tr:last-child").clone(true);

</script>
Posted one year ago

Hi mukesh1,

No you can't change

response and response1 is the object and d is property of response and response1.