Support the ongoing development of Laravel.io →
Requests Blade
Last updated 1 year ago.
0

sandysh said:

Hello everyone, I am new to laravel and i have been working on a web app using this framework. Few days ago i got stuck in some code which i cant seem to understand at all. I am trying to pass a URL to an ajax request, the code goes like this if (pageurl.indexOf("externalnested.htm")!=-1){ the problem is it only accepts direct link as shown in the above example "externalnested.htm", but we all know that laravel does not accept direct routes, we need to pass it via routes, so i tried using if (pageurl.indexOf("{{ url('/mypage') }}")!=-1){, but it doesn't seem to work.

Any help will be greatly appreciated.

Thank you

Urls helpers should works in javascript with no problem. Can you refer more informations about the error you get?

0

Thank you @Othmanus for quick reply. I solved the problem. The problem was that javascript doesn't support {{url('')}} functions as such. Hence the only thing that i had to do my remove the url and adjust few things.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

sandysh sandysh Joined 30 Mar 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.