$.Ajax is not a function during combo box selection change

Here is the Code. I've already researched about it and so far, haven't found the right solution. Any help would be much appreciated. Thanks.

    <script type="text/javascript" src="{%static 'javascript/jquery-3.1.1.js'%}"></script>
    <script type="text/javascript">

		$(document).ready(function(){
			$("#itemid").change(function(){
				var itemid = $(this).val();
				var func_url = '/get_itemdetails/' + itemid +'/';
				$.ajax({
					type:"GET",
					url: func_url,
					dataType:"json",
					success: function(data){
						console.log(data);
					}
				});
			});
		});
		
	</script>

Answers 1

  • Below is the latest script header for Google's hosted CDN which allows for the $.ajax Function:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
        <script type="text/javascript">
    
    		$(document).ready(function(){
    			$("#itemid").change(function(){
    				var itemid = $(this).val();
    				var func_url = '/get_itemdetails/' + itemid +'/';
    				$.ajax({
    					type:"GET",
    					url: func_url,
    					dataType:"json",
    					success: function(data){
    						console.log(data);
    					}
    				});
    			});
    		});
    		
    	</script>


Related Articles