阿贾克斯:加载网页内容div内选择框 [英] Ajax: Load page content to div with select box
本文介绍了阿贾克斯:加载网页内容div内选择框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图加载页面内容为通过Ajax一个div当选择了选择选项
I'm trying to load page content into a div via Ajax when a select option is selected
如。我有一个选择框有2个选项的值的test.html和test1.HTML下,我有一个div,并想从test.html中和test1.HTML内容的选择框发生变化时,分区加载...通过Ajax 有什么建议?
eg. I have a select box with 2 options the values are test.HTML and test1.HTML and under that I have a div and want the content from test.HTML and test1.HTML to load in the div when the select box changes... Via Ajax any suggestions?
感谢
推荐答案
当然,这可以是很简单的:
Sure, that can be rather simple:
$("#mySelect").change(function(){
$("#myDiv").load( $(this).val() );
});
<select id="mySelect">
<option>test.html</option>
<option>test1.html</option>
</select>
<div id="myDiv"></div>
这篇关于阿贾克斯:加载网页内容div内选择框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文