开发者

jquery get call complete function not working

I have a web application that gets data with a get call. When it is called, it sets a static variable. After the call is complete I want to get the value, but the complete function that I call is not working, its calling it to fast because its null.

 $.get('../Controls/myfullcontrol.aspx', {}, function (data) {
        $('#SiteFullControl').html(data);


    }).complete(function () {
开发者_Python百科        $('#FullControlCount').html('Full Control (<%=GlobalClass.GlobalVariables.User.Count %>)');
        $('#LoadingAjax').dialog('close');

    });


Using Firebug or Chrome's Inspector, look at the XHR and ensure that the script is actually returning something.

Are you looking for data returned to the complete function?

Then you need a parameter in the function:

  }).complete(function (data) {


You don't need the $.complete() method because the $.get() contains allready an success callback.

http://api.jquery.com/jQuery.get/

You could work with jQuery the Promise interface (introduced in 1.5).So you can chain multiple callbacks on a single request...

Take look: http://api.jquery.com/jQuery.get/#jqxhr-object

jQuery.get( url, [data,] [success(data, textStatus, jqXHR),] [dataType] )

$.get('ajax/test.html', function(data) {
   //STUFF AT SUCCESS
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜