Skip to content

Instantly share code, notes, and snippets.

@rauhryan
Forked from anonymous/gist:3380313
Created August 17, 2012 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rauhryan/3381100 to your computer and use it in GitHub Desktop.
Save rauhryan/3381100 to your computer and use it in GitHub Desktop.
(function($,window) {
// doc ready
$(function(){
$("select.select").each(function(){
$(this).change(function() {
$.ajax({
url: "url",
data: {
value: $(this).val()
},
dataType: "json",
success: function (data) {
},
error: function(){
}
});
})
});
});
})(jQuery,window);
function callAjax(){
$.ajax({
url: "url",
data: {
value: "derp"
},
dataType: "json",
success: function(data){
//do stuffs
},
error: function(){
alert("error!");
}
});
}
<select class="select " id="" name="" required="" onchange="callAjax()">
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option></select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment