Laravel 5 External JavaScript Files_ JavaScript stack

the following JavaScript is working perfect in side the test.blad.php file
but when i made external test.js file at the browser i get some thing like

http://localhost:8000/%7B%7Burl('/barcode')%7D%7D?j_barcode=112234

instead of

 http://localhost:8000/barcode?j_barcode=112234

the code in test.js file is :

$(document).ready(function(){ 
 $('#barcode').keyup(function(event){
  if(event.keyCode == 13){            
            var j_barcode = $('#barcode').val();      
   $.get("{{url('/barcode')}}", {j_barcode:j_barcode},   function(data) {   
         console.log(data) ;
        //success data                                             
         $.each(data,function(i, obj){       
            document.getElementById("item").value =obj.itemName;
            document.getElementById("itemId").value = obj.id;

            console.log(data) ;
        });
      });

      } 
  });

});

and the route.php

Route::get('/barcode'    , 'testController@getBarcode');

at last i decleared the test.js in test.blade.php as

<script  type="text/javascript" src="/hsm/js/test.js" ></script>

68 thoughts on “Laravel 5 External JavaScript Files_ JavaScript stack”

  1. 819910 63548The vacation delivers on offer are : believed a selection of some with the most selected and in addition budget-friendly global. Any of these lodgings tend to be really used along units may possibly accented by indicates of pretty shoreline supplying crystal-clear turbulent waters, concurrent with the Ocean. hotels packages 56960

    Reply

Leave a Comment