Click here to Skip to main content
Sign Up to vote bad
good
See more: WCFjQueryServices
Friends,
 
I using the below code for deleting the list from three tables(Deleting Perfectly!). It will take hardly 10 seconds for deleting.
 
Here, I want to show please wait image for these waiting time..
It will show when starting the process and hide on delete process completed
 
$(document).ready(function () {
               $.ajax({
                        cache: false,
                        async: true,
                        type: "GET",
                        dataType: "json",   
                        url: "../Services/MasterServices.svc/DeleteList",
                        data: { name: vatid },
                        contentType: "application/json;charset=utf-8",
                        success: function (r) {
                            if (r != null) {
                                alert("Removed Successfully");
                            }
                        },
                        error: function (e) { alert(e.statusText); }
 
                    });
                });
Any help!!!
 
Thanks,
Karthik.J
Posted 22-Nov-12 1:06am


2 solutions

<span id="ajax_loading_div" style="display: inline-block;<br mode=" hold=" />    width: 150px;"></span>
 
<script type="text/javascript" language="javascript">
$(document).ready(function () {
                    $("#ajax_loading_div").addClass("loading");
                    $.ajax({
                        cache: false,
                        async: true,
                        type: "GET",
                        dataType: "json",
                        url: "../Services/FinMasterServices.svc/DeleteListCompany",
                        data: { name: vatid },
 
                        contentType: "application/json;charset=utf-8",
                        success: function (r) {
                            $("#ajax_loading_div").removeClass("loading");
                            if (r != null) {
                                alert("Removed Successfully");
                            }
                        },
                        error: function (e) { alert(e.statusText); }
 
                    });
                });
</script>
  Permalink  
You need to add ajaxStart() method to your code. Within this method, you can have any type of loading indicator, or changing the screens transparency etc...
  $("yourDivOrAnyControl").ajaxStart(function(){
    $(this).html("<img src="loadingImage.gif" />");
  });
So, final code would look something like,
$(document).ready(function () {
       $("yourDivOrAnyControl").ajaxStart(function(){
            $(this).html("<img src="loadingImage.gif" />");
       });
 
       $.ajax({
                cache: false,
                async: true,
                type: "GET",
                dataType: "json",   
                url: "../Services/MasterServices.svc/DeleteList",
                data: { name: vatid },
                contentType: "application/json;charset=utf-8",
                success: function (r) {
                    if (r != null) {
                        alert("Removed Successfully");
                    }
                },
                error: function (e) { alert(e.statusText); }
 
              });
});
 
For more information please see this link
http://api.jquery.com/ajaxStart/[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 6,959
1 Prasad_Kulkarni 3,671
2 OriginalGriff 3,359
3 _Amy 3,332
4 CPallini 2,925


Advertise | Privacy | Mobile
Web01 | 2.6.130617.1 | Last Updated 23 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid