I've got a page with cascading drop down lists (the available options of one drop down list is determined by the selection of another). I was an ajax call to fill this second select:
$.ajax({
url: "/sport_types/"+$(this).val()+"/leagues"
dataType: "json"
success: (data) ->
$(".league_selector option").remove()
row = "<option value=\"\">Choose a League...</option>"
$(".league_selector").append(row)
$.each data, (i, j) ->
row = "<option value=\"" + j.id + "\">" + j.league_name + "</option>"
$(".league_selector").append(row)
})
This works fine, but if a user clicks the back button on their browser, this dynamically generated content is not loaded.
I'm running a rails app, just in case there's an easy way to handle this in rails, awesome. If not, any good ol' HTML/jQuery tricks would be greatly appreciated.