Hey All,
This is more of a general jQuery/AJAX question than specific to Tethys but I can give it a tethys spin and it may be useful to someone in the group.
I have an event listener watching a select box form. When an option is selected the code passes the selection to an AJAX call which I then hope to use to requery the database and reload the map (using the TETHYS_MAP_VIEW.reInitializeMap(); method). Here is the code:
var select_index_no = document.getElementById('index-no-form');
select_index_no.addEventListener("select",function(event) {
var selected_index_nos = $("#index-no-form option:selected").each(function(){
$.ajax({
url: 'map',
method: 'POST',
data: {'selected_index_nos' : selected_index_nos
},
success: function(data) {
//add new map to map div
$('#main_map_div').html(data);
TETHYS_MAP_VIEW.reInitializeMap();
}
});
});
}); // document ready
It seems as though the AJAX call doesn't like the .each() call I make in line 3. My question is what method should I use to pass the selection to AJAX or am I misinterpreting the exception I am receiving?
Thanks,
Joseph