Monday, March 13, 2017

How to get jQuery variable with PHP

I have defined a jQuery variable

var user_id = parseInt($(this).attr('id').replace(/[^\d]/g, ''));

and i want to get the user name like this:

alert({!! \App\User::findOrFail(user_id)->name !!});

Is this even possible?

i get this error:

enter image description here How can i get the user name through jQuery variable??



via lewis4u

Advertisement