Home > Backend Development > PHP Tutorial > DIV标签下显示ajax返回来的值

DIV标签下显示ajax返回来的值

WBOY
Release: 2016-06-13 12:56:14
Original
1303 people have browsed it

DIV标签上显示ajax返回来的值
有4个DIV,


 

 

 

其中一个DIV出现的顺序是不一定的。内容等于var one = 'one';
也就是每次有一个随机的DIV的内容是 one; 但是其他的DIV内容是空的
这样的话, 请问这样如何把来自ajax返回来的三个值; aa, bb, cc
var aa ='aa';
var bb = 'bb';
var cc = 'cc';
分别传到另外三个DIV中?

------解决方案--------------------
<br />
<script type="text/javascript"><br />
jQuery(function(){<br />
	var str = ['aa','bb','cc'];<br />
	var i=0;<br />
	jQuery(".englishdiv").each(function(){<br />
		if(jQuery(this).html() == "")<br />
		{<br />
		    jQuery(this).html(str[i++]);<br />
		}<br />
	});<br />
});<br />
</script><br />
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template