开发者

Loading image gives a 403 error with Jquery call/post

Hi guys i want to use an load image during the .ajax request with Jquery. I found some tutorial on internet to achieve this. But i get 403 error...

Here some code:

$.ajax({
        type: "POST",
        url: "person_controller.php?action=newConsult",
        data: dataString,
        success: function(div){
            $("#gener开发者_如何学CateDiv").html('<img src="css/images/ui-anim_basic_16x16.gif" />');
            $('#generateDiv').load(div);
        },
    });

When i run the above code, firebug gives me 403 error(you don't have permission to access). But i am only loading the image?!? Without the image it does work.

The path of image is correct i see the image spinning but firebug gives me the 403 error. How is this possible when i run this application on localhost?


you could try the following which sets the loading image prior to the request.

$.ajax({
    type: "POST",
    url: "person_controller.php?action=newConsult",
    data: dataString,
    beforeSend: function() {
        $("#generateDiv").html('<img src="css/images/ui-anim_basic_16x16.gif" />');
    },
    success: function(div){            
        $('#generateDiv').html(div);
    },
});

Alternativly, you could use the BlockUI jQuery plugin (http://jquery.malsup.com/block/)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜