I want to call the ajax function once user clicks on the select control or the select control gets focus to itself from keyboard.
HTML code is as follows :
<select id="scanner" name="scanner" class="form-control"></select>
The jQuery-AJAX function I wrote is as follows but the aler("Hello") is not getting printed. why so?
$("#scanner").bind("change",function() { alert("Hello");
var mod_url = $('#mod_url').val();
$.ajax({
url : mod_url,
cache: false,
dataType: "json",
type: "GET",
async: false,
data: {
'request_type':'ajax',
'op':'get_all_stores'
},
success: function(result, success) { alert(result);
$('#scanner').html(result);
},
error: function() {
alert("Error is occured");
}
});
});