Walter Davis wrote in post #1111896:
> The simple answer is "with JavaScript".
>
> If you are filling that DIV with the result of a normal RESTful route,
> like /widgets/2 (show) then you can do something like this:
>
> $('widget_id_picker_dom_id').observe('change', function(evt){
> new Ajax.Updater('div_to_update', '/widgets/' + $F(this), { method:
> 'get });
> });
>
> That's Prototype.js code, I am sure there is something similar in
> jQuery.
The jQuery
-----------------
$(function() {
$('#widget_id_picker_dom_id').change(function() {
# Non-AJAX update (no server request)
$('#div_to_update').html("html content here...");
# AJAX update
$('#div_to_update').load("/url/to/retrieve/div/contents", function()
{
# Optional completion handler called after loading the div
contents
});
});
});
Note: This is wrapped inside $(function() {}); which watches for the DOM
ready event before binding to the control widget change event. We use
Unobtrusive JavaScript these days rather than the old-style DOM event
attributes.
<select .... onchange="myFunction();"></select> # This is obtrusive
(i.e. inline) and doesn't belong in HTML. Separate your page structure
from behavior.
http://en.wikipedia.org/wiki/Unobtrusive_JavaScript