I'm trying to load page content into a div via Aja开发者_StackOverflow中文版x when a select option is selected
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?
Thanks
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>
精彩评论