I'm not that familiar with jQuery but you'll be able to find the right syntaxis.
The idea is just to get the appropriate HTML based on your selected option. That is, its corresponding value.
Consider testHTML:
And JavaScript:
$.each("option").click(function() {
var label = $(this).parent.label;
var elementToUpdate = $( "#" + label ); // one of the divs in TestHTML
var value = (this).value;
var url = "http://mysite.php?id=" + value;
var newHTML = $.ajax({ url: url }).done(function(){
elementToUpdate.replaceWith( newHTML );
});
});
Or maybe even:
And
$.each("option").click(function() {
var elementToUpdate = $( "#selectedContent" ); // one of the divs in TestHTML
var value = (this).value;
var url = "http://mysite.php?id=" + value;
var newHTML = $.ajax({ url: url }).done(function(){
elementToUpdate.replaceWith( newHTML );
});
});