I’m beginning with php, jquery and Slim PHP framework and I got stuck in making Slim handler (route) for jqeryUI autocomplete request.
- jqeryui autocomplete sends data as a
termGET parameter, i.e.restapi.php/test/?term=hello - with Slim I can handle requests like
restapi.php/test/hello, etc.
How to solve? My own considered solution is to rewrite the URL with the mod-rewrite (anyway basically using it with the Slim), but I’m not sure if this is the right way.
I’ll be glad for your revisions and suggestions and if rewriting is the best way, some references with examples will be helpful for me. Thank you.
Actually, you probably shouldn’t be using
/*to do what you’re doing. SLIM provides a method that can get the parameters of your request.This will give you an array of request parameters. So if your get request was something like this:
Furthermore, you can grab specific parameters by throwing in an arg into the
param()method.It’ll make life easier to have that distinction between your route parameters and request parameters. 😉