本文介绍了如何在img中显示加载img直到ajax请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在图片中显示加载gif, 我正在从数据库中检索图像和值,图像将显示在img控件中,值将显示在文本框中,我希望直到图像从数据库中反转我想在同一控件中显示加载gif,其中将显示来自数据库的反向img。并且在img之后数据库在img控件中完全加载,然后值应显示在文本框中。 i做了这样的事情。
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);
推荐答案
('#imgAssetCard')。load(function(){})。attr( 'src',.. / images / loading.gif); ('#imgAssetCard').load(function () { }).attr('src', "../images/loading.gif");
var ImagePath = "GetImageHandler.ashx?param=" + date + "&assetDesc=true&Opt=AssetDesc&Invid=" + Invid + "";
('#imgAssetCard')。load(function(){ ('#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); .ajax({ type: "POST", url: "AjaxGetAssetTagNumAssetDesc.aspx?param=" + date + "&Invid=" + Invid + "", async: false, success: function (strData) { response = strData; if (strData != "") { } }); }).attr('src', ImagePath);
更多推荐
如何在img中显示加载img直到ajax请求
发布评论