Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery Ajax方法中的.load()可以用来加载图像吗?_Javascript_Jquery_Image_Methods_Load - Fatal编程技术网

Javascript jquery Ajax方法中的.load()可以用来加载图像吗?

Javascript jquery Ajax方法中的.load()可以用来加载图像吗?,javascript,jquery,image,methods,load,Javascript,Jquery,Image,Methods,Load,我可以问一下jqueryajax加载图片的方法吗,下面是我的代码,失败了,有人能纠正吗 <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("div").ajaxStart(function(){ $(this

我可以问一下jqueryajax加载图片的方法吗,下面是我的代码,失败了,有人能纠正吗

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("div").ajaxStart(function(){
    $(this).html("<img src='http://www.w3schools.com/jquery/demo_wait.gif' />");
  });
  $("button").click(function(){
    $("div").load("http://www.google.com/images/logos/ps_logo2.png/");
  });
});
</script>
</head>
<body>

<div><h2>Let AJAX change this text</h2></div>
<button>Change Content</button>

</body>
</html>

$(文档).ready(函数(){
$(“div”).ajaxStart(函数(){
$(this.html(“”);
});
$(“按钮”)。单击(函数(){
$(“div”)。加载(“http://www.google.com/images/logos/ps_logo2.png/");
});
});
让AJAX更改此文本
更改内容

否。只需创建一个
img
元素,设置
src
,并将其放置在您希望的位置

$("div").empty().append($("<img/>", {src: "http://www.google.com/intl/en_ALL/images/srpr/logo1w.png"}));
$(“div”).empty().append($(“

否。只需创建一个
img
元素,设置
src
,并将其放置在您希望的位置

$("div").empty().append($("<img/>", {src: "http://www.google.com/intl/en_ALL/images/srpr/logo1w.png"}));
$(“div”).empty().append($(“
可能是

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("div").ajaxStart(function(){
    $(this).html("<img src='http://www.w3schools.com/jquery/demo_wait.gif' />");
  });
  $("button").click(function(){
    $("div").html("<img src='http://www.w3schools.com/jquery/demo_wait.gif' />");
  });
});
</script>
</head>
<body>

<div><h2>Let AJAX change this text</h2></div>
<button>Change Content</button>

</body>
</html>

$(文档).ready(函数(){
$(“div”).ajaxStart(函数(){
$(this.html(“”);
});
$(“按钮”)。单击(函数(){
$(“div”).html(“”);
});
});
让AJAX更改此文本
更改内容
可能是

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("div").ajaxStart(function(){
    $(this).html("<img src='http://www.w3schools.com/jquery/demo_wait.gif' />");
  });
  $("button").click(function(){
    $("div").html("<img src='http://www.w3schools.com/jquery/demo_wait.gif' />");
  });
});
</script>
</head>
<body>

<div><h2>Let AJAX change this text</h2></div>
<button>Change Content</button>

</body>
</html>

$(文档).ready(函数(){
$(“div”).ajaxStart(函数(){
$(this.html(“”);
});
$(“按钮”)。单击(函数(){
$(“div”).html(“”);
});
});
让AJAX更改此文本
更改内容

我想要的是在加载大图像时,而不是观看图像加载,我想要一个预加载程序,直到图像完全加载。谢谢!!@戏剧,那么你可能会觉得有用。我想要的是在加载大图像时,而不是观看图像加载,我想要一个预加载程序,直到图像完全加载。谢谢!!@戏剧,那么你呢可能会有帮助。