I am trying to do the following
$("select.languages").on("change", function(){
var lang = $(this).find("option:selected").text();
$.get(url: "/search",
data: {"lang": lang},
dataType: 'script');
});
so every time a language is selected I would call /search
with the language and by other SO answers to make dataType be "script"
but this doesn't quite work. What does work is
$.get( "/search.js",{"lang": lang} )
yet this pollutes the url since the format is very explicit and doing using this method requires me to add extra pointless code
can I implicitly set the response format?