0

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){
            $("#generateDiv").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?

4

1 回答 1

2

您可以尝试以下在请求之前设置加载图像的方法。

$.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);
    },
});

或者,您可以使用 BlockUI jQuery 插件 ( http://jquery.malsup.com/block/ )

于 2011-05-13T18:06:08.697 回答