@boermans The first thing I tried was your example:
ajax: {url: $("select#chained").val() +'_1.js'}, I don't think this works inside this structure, but then I'm not reallty sure how to test the variable INSIDE THIS STRUCTURE! :) Here is my whole code now... <script type="text/javascript"> var selectVal = $("select#bchained").val(); var countryList = selectVal + '_1.js'; var cityList = selectVal + '_2.js'; alert (countryList); //just to test the varaible alert (cityList); //just to test the variable jQuery(document).ready(function() { jQuery("#bchained_child").cascade("#bchained",{ ajax: {url: countryList}, template: commonTemplate, match: commonMatch }); alert(selectVal, jsonUrl); jQuery("#bchained_sub_child").cascade("#bchained_child",{ ajax: {url: cityList }, template: commonTemplate, match: commonMatch }); }); </script> The two alerts pop up when the page is first loaded or reloaded and the variables are correct. However, I don't think they get changed when the value in the select box gets changed. In other words, that first variable declaration var selectVal = $("select#bchained").val(); only happens when the page is LOADED/RELOADED, and not dynamically through the DOM. I need to figure out how to get either a) those variables updated when a select box value changes, or b) some way to append my simple file extensions to the value inside the ajax: {url: ???} call..... Is there a way to add a function inside the ajax: {url: } structure? On Feb 2, 5:33 am, boermans <boerm...@gmail.com> wrote: > On Feb 2, 5:20 pm, James <james.tilb...@gmail.com> wrote: > > > > > But let's say I want to append an extension to "pizza". For example I > > want "pizza.json", or "pizza_1.js". > > > How do I get this extra string text into the ajax option above? > > > I have tried + notation, various combinations of brackets, etc. But I > > just can't get it to work and can't find appropriate documentation > > anywhere on this. > > It could be useful to see your code - even if it’s not working. > > Did it look anything like this? > > ajax: {url: $("select#chained").val() +'_1.js'}, > > If that doesn’t work, break it down: > > var selectVal = $("select#chained").val(); > var jsonUrl = selectVal + '.json'; > > and use the variable > > jQuery("#chained_sub_child").cascade("#chained_child",{ > ajax: {url: jsonUrl}, > template: commonTemplate, > match: commonMatch > }); > > If that’s not working you can try something like this to help reveal > where the problem is > console.log(selectVal, jsonUrl); > > Hope that gets you on the road :)