Get select box value to use as a variable

Yeah!

New Member
I'm hoping someone can help, I'm a relative newbie to javascript and have the following issue. I have a select box with id "mySelect"that is populated with the following code - \[code\]$(document).ready(function(artists){ $.ajax({ type: "GET", url: "bookinglist.xml", dataType: "xml", success: function(artists_list) { var select = $('#mySelect'); var artistsArr = []; $(artists_list).find('vw_ADM_BookingListNull[strArtistName]').each(function(){ var artists = $(this).attr('strArtistName'); if ($.inArray(artists, artistsArr) == -1) { select.append('<option value="'+artists+'">'+artists+'</option>'); artistsArr.push(artists); } }); select.children(":first").text("please make a selection").attr("selected",true); } }); });\[/code\]I need to use the selected value as a variable to insert into another piece of code. How do I make a variable from this? The variable will be used in place of \[code\]'vw_ADM_BookingListNull[strArtistName="James Zabiela"]'\[/code\]in the following code which populates a table from an xml list. \[code\]$(document).ready(function(unavailable){ $.ajax({ type: "GET", url: "bookinglist.xml", dataType: "xml", success:(function(unavail){ $(unavail).find('vw_ADM_BookingListNull[strArtistName="James Zabiela"]').each(function() { var venue = $(this).attr('strVenueName'); var artist = $(this).attr('strArtistName'); var booking_date = $(this).attr('dteEventDate').substr(0,10); //subtr strips date down if(!(booking_date >= $nowformat && booking_date <= $advformat)){ $('<tr style="display:none;"></tr>') } else { $('<tr></tr>').html('<th>'+booking_date+'</th><td>'+artist+'</td>').appendTo('#unavail'); } }); }) }); });\[/code\]I need to handle the possible event that a value has not been selected and so the value of the select box will be "please make a selection", which is set as the default value. So I guess I need to wrap some kind of if statement around the code that creates the table, so as to not display anything if nothing has yet been selected. Any help would be massively appreciated as deadlines are looming. Thanks again.
 
Back
Top