I am trying to load a page using jquery load function in laravel. My code is,
$(document).ready(function() {
$('.btn').on('click', function(){
id = this.id;
$('#div-details').load('{{URL::to("users/details/'+id+'/view")}}');
});
});
When I try this code I am getting an error,
syntax error, unexpected ''+id+'' (T_CONSTANT_ENCAPSED_STRING)
When I try the load function without id variable works fine. Like,
$('#div-details').load('{{URL::to("users/details/55/view")}}');
How can I load the id properly ?
id = $(this).attr('id');$('#div-details').load('users/details/55/view');. can you post the result of it.$('#div-details').load('users/details/'+id+'/view');