mercredi 25 novembre 2020

Route is not working inside the controller

I did an autocomplete search function in Laravel using ajax. I tried to pass the route inside the href but it's working. I don't know how to pass the route in the controller. Please help me and give a solution on how to fix this.

$output = '';

        if (count($pro)>0)
        {
            foreach ($pro as $row)
            {
                $url = "";

                $output .= '<li><a href="'.$url.'">'.$row->product_name.'</a></li>';
            }
        }
        else {

            $output .= '<li>'.'No results'.'</li>';
        }

        return $output;

Now once I click the li tag URL is coming like this.

https://testing.com/product-detail/%7B%7B%20route('ProductDetail','.Chiaro-Tote-1.')%20%7D%7D

I attached the screenshot here

enter image description here



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/39eYS6O
via IFTTT

Aucun commentaire:

Enregistrer un commentaire