javascript - Why the AJAX function is not getting called and alert is not getting printed upon calling the function? -


i want call ajax function once user clicks on select control or select control gets focus keyboard.

html code follows :

<select id="scanner" name="scanner" class="form-control"></select> 

the jquery-ajax function wrote follows aler("hello") 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 occured");       }     });   }); 

in code haven't seen options html select box

and, have registered change event on select box occur on selecting options in select box

add few options in select box , try select options fire ajax call

see js fiddle here


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -