Welcome Guest, Not a member yet? Register   Sign In
403 error in AJAX to Controller
#8

Your getting an error because your Ajax base url is wrong.

Add to your header on top at the bottom before the closing </head> tag

Code:
<!-- Pass base_url() and site_url() to JavaScript -->
<script>
    var baseUrl = "<?= base_url();?>";
    var siteUrl = "<?= site_url();?>";
</script>

Then in your ajax method add this.

Code:
// Ajax url:
url: baseUrl + "links/index",

Try that.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: 403 error in AJAX to Controller - by ciadmin - 10-27-2019, 07:12 AM
RE: 403 error in AJAX to Controller - by mintwint - 10-27-2019, 07:22 AM
RE: 403 error in AJAX to Controller - by ecampait - 10-27-2019, 07:55 AM
RE: 403 error in AJAX to Controller - by InsiteFX - 10-28-2019, 03:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB