How do I add a dynamic parameter in getJSON url? [code] function onSelectChange(){ var whatChecked = $("input:checkbox:checked").val(); $.getJSON("select.php", {whatChecked:"somevalue"}, function(json) { ...stuff to do } [/code]
I want the url that getJSON uses to be dynamic and look like: select.php?whatChecked=somevalue for example select.php?carType=compact I can get the somevalue, no problem, but I can't figure out how to make whatChecked be the value eg carType and not the word whatChecked!