I have the following working code. This displays a drop down and also fetches a html file to be displayed:
$.getJSON(\'json/shares.json\', function(data) {
Seems like you just need to bind to the .change
event of the dropdown you are creating to do the submission, which you can retrieve with .get
. You can use jQuery to parse the html. It does a nice job of that:
.appendTo('#shares')
.change(function () {
$.get($(this).val() + '_shares.html)
.done(function (html) {
var $table = $(html).find("table tr:first td").slice(0,5);
})
.fail(function () { /* no such file */ });
});
This code is untested, but hopefully you can follow the example. Also beware of GET
caching.