Support the ongoing development of Laravel.io →
Input Blade Laravel.io
Last updated 2 years ago.
0

Hi Destructor,

As long as this javascript is within blade it should work just fine, meaning, your code must be inline script.

Another way to go about is, define that url you want to use in your blade view and call it in external javascript. e.g.

At the head of my blade view i would have this:

  <script type="text/javascript">
	 	var deletePostUri = "{{ route('delete_post',$post_id)}}";
	</script>

Now deletePostUri is globally defined within that page, any javascript inline or external that is loaded after will have access to it.

I hope that helps.

Thanks

Last updated 8 years ago.
0

Thanks for help :)

0

Isn't it vulnerable to CSRF?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.