JQuery中的readyState

In ajax I used

if (xmlhttp.readyState==4)
{
    document.getElementById('cTxt').innerHTML=xmlhttp.responseText;             
}
else
{
    document.getElementById('cTxt').innerHTML="<img src='img/loader.gif' width='15' height='15' />";
}

The same I need in JQuery.

Rather than having this kind of ready-state jQuery uses callback functions to handle AJAX requests. Take a look at $.ajax(). There are parameters like success and error which can be given a function, that will be called if the state is reached.

Try this

function send_ajax()
{
    $('#cTxt').html("<img src='img/loader.gif' width='15' height='15' />");
    $.ajax({
        url: "Your page url where ajax request will be sent",
        success: function(data){
            $("#cTxt").html(data);
        }
    });
}

Here is the corresponding :

$(document).ready(function () {
     $.ajax(
         type : 'GET',

         data : 'data=val',

         url  : 'foobar.php',

         success : function(text){
                         $("#cTxt").html(text.responseText);

     }
     )
});