I am wondering about how people go about using CodeIgniter and jQuery for AJAX.
In your AJAX request you have
{
url : ???,
data : {a:1,b:2},
success: ....
}
So, how do you build the URL?
Do you
- have all your JavaScript in your view files, and just use
site_url()to build the URL - have all your JavaScript in external js files, have a header view you include that has something like
<script>var base_url = '<?php echo site_url(); ?>';</script>. Then in your external js files haveurl: base_url+'rest/of/path/'; - some other method?