Welcome Guest, Not a member yet? Register   Sign In
Codeigniter: AJAX fails to access the controller: Access-Control-Allow-Origin
#4

(This post was last modified: 01-31-2017, 08:35 AM by InsiteFX.)

Looking at your page source code there is no form action code to tell it where to go.

You can pass CodeIgniter base_url to Ajax using the below:

Place in your html head tag

Code:
    <!-- jQuery baseUrl -->
    <script>
        var baseUrl = "<?php echo base_url(); ?>";
        var siteUrl = "<?php echo site_url(); ?>";
    </script>

Now you can access it in Ajax using baseUrl or siteUrl.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: Codeigniter: AJAX fails to access the controller: Access-Control-Allow-Origin - by InsiteFX - 01-31-2017, 08:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB