如何在img中显示加载img直到ajax请求

编程入门 行业动态 更新时间:2024-10-28 01:12:53
本文介绍了如何在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请求

本文发布于:2023-10-29 20:25:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1540652.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载   如何在   img   ajax

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!