0

I'm new to this concept and working around with some basic examples to understand the asynchronous calls

   $(document).ready(function () {

            $('#btnLoadData').click(function () {

                $.ajax({

                    url: 'dummy.html',
                    dataType: 'html',

                    sucess: function (result) {
                        alert("into sucess");
                        $('#para').innerHtml = result;
                    },
                    error: function () {
                        alert("error while sending a request")
                    },
                    complete: function (obj,status) {
                        alert(status);
                    }
                });
            });
        });

In the above code my alert function in complete event is fired.But my success event is not fired .But in Firebug console i can see my html response got through this request ....If this is not correct then how can i access the html data returned through this request

This worked fine if I go with simple .load(url) function of Jquery

Thanks for the help,

Ein2012
  • 1,103
  • 1
  • 13
  • 33

2 Answers2

3

Because of simple typo in your code, there is nothing wrong in your code

success: function (result) {
    //-^--------------
    alert("into sucess");
    $('#para').innerHtml = result;
},
Pranav C Balan
  • 113,687
  • 23
  • 165
  • 188
1

The spelling of success is wrong.

$(document).ready(function () {
        $('#btnLoadData').click(function () {

            $.ajax({

                url: 'dummy.html',
                dataType: 'html',

                success: function (result) {
                    alert("into sucess");
                    $('#para').innerHtml = result;
                },
                error: function () {
                    alert("error while sending a request")
                },
                complete: function (obj,status) {
                    alert(status);
                }
            });
        });
    });
zisoft
  • 22,770
  • 10
  • 62
  • 73