[jQuery] Dynamic url in ajax call based on select value
I'm kind of scratching my head over this. Okay, so let's say I want
to dynamically load a specific JSON flat file (could be xml, whatever)
depending on the current select box:
jQuery("#chained_sub_child").cascade("#chained_child",{
ajax: {url: $("select#chained").val() },
template: commonTemplate,
match: commonMatch
});
If the VALUE in the #chained select box was, let's say, "pizza",
jQuery would go ahead and attempt to load a file named "pizza".
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.
Any ideas?
Thanks,
James