I'm trying to put 2 scripts in 1 js file and i'm getting:
SyntaxError: missing } after property list
note: { opened at line 9, column 19
But as far as I check all the curly brackets are closed, not sure what the real issue is.
Code
// country
jQuery( document ).ready( function( $ ) {
$('select[name="country"]').on('change', function() {
$.ajaxSetup({
headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') }
});
var CountryId = $(this).val();
if(CountryId) {
$.ajax({
url: '{{ url('getprovinces') }}/'+encodeURI(CountryId),
type: "GET",
dataType: "json",
success:function(data) {
$('select[name="province"]').empty();
var options = data.map(function(state) {
return $("<option class='form-control'>").val(state.id)
.text(state.name);
});
$('select[name="province"]').empty().append(options);
}
});
}else{
$('select[name="province"]').empty().append("<option class='form-control' value='' selected>Select</option>");
}
});
});
error comes from this line:
url: '{{ url('getprovinces') }}/'+encodeURI(CountryId),
Any idea?