[Vuejs]-Getting empty array while using %LIKE% in Laravel

0👍

From the comments (dd($searchKey)), I can see you are calling this URL

http://localhost:8000/getLocations/%7Ban%7D 

or (same)

http://localhost:8000/getLocations/{an}

by calling the URL in this way you are actually including the curly brackets in the SQL statment:

Select * from location like "%{an}%"

this is why you are getting an empty result.

In order to solve your problem just change the URL removing the brackets:

http://localhost:8000/getLocations/an

Leave a comment