Click here to Skip to main content
15,908,264 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to show loading gif inside a image,
I am retrieving image and values from the database, image will be shown in img control and values will be shown in textbox,I want till the image is retrive from the database i want to show loading gif in the same control where the retrive img from database will be shown .and after the img from the database in fully loaded in img control then the values should be display in text box.

i did some thing like this.
$('#imgAssetCard').load(function () {
 }).attr('src', "../images/loading.gif");


var ImagePath = "GetImageHandler.ashx?param=" + date + "&assetDesc=true&Opt=AssetDesc&Invid=" + Invid + "";


$('#imgAssetCard').load(function () {
  $.ajax({
           type: "POST",
           url: "AjaxGetAssetTagNumAssetDesc.aspx?param=" + date + "&Invid=" + Invid + "",
           async: false,

           success: function (strData) {
               response = strData;

               if (strData != "") {
}


       });

   }).attr('src', ImagePath);
Posted

You can show the image on request start and hide it on success like this..

XML
<div id='loading' style='display:none'>
  <img src='loadinggraphic.gif'/>
</div>


function getData()
{
    $('#loading').show();  // show the loading message.
    $.ajax({
        url: your url,
        type: "POST",
        cache: false,
        data: ,
        success : function(){
            $('#loading').hide(); // hide the loading message
        }
    });
 
Share this answer
 
 
Share this answer
 
use updateprogres[^]

the above link will help you...
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900