404 how make a rote - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: 404 how make a rote (/showthread.php?tid=67005) |
404 how make a rote - imediasun - 01-01-2017 I send ajax to server $.ajax({ type: 'POST', dataType:'json', url: '/functions_ajax/check_all_Ukraine', There is a server side class Functions_ajax extends CI_Controller { public function __construct() { parent:: __construct(); $this->load->helper('url'); require('server/FirePHP.class.php'); $this->load->model('cities_model'); $firephp = FirePHP::getInstance(true); $firephp -> fb("hello world! i'm warning you!",FirePHP::WARN); } public function check_all_Ukraine(){ $data=$this->cities_model->get(); if($data){ echo json_encode($data); } else{ echo json_encode(NULL); } } } And this is A route $route['functions_ajax/check_all_Ukraine'] = 'functions_ajax/check_all_Ukraine'; But I still have 404 error RE: 404 how make a rote - Wouter60 - 01-01-2017 Use this for the url: PHP Code: url: '<?php echo site_url();?>functions_ajax/check_all_Ukraine', RE: 404 how make a rote - XtreemDeveloper - 01-16-2018 Firstly define base_url in header. <script type="text/javascript"> var site_url = '<?php echo site_url(); ?>'; var base_url = site_url; var siteurl = site_url; </script> after that you can use url something like that where you want in whole project files. $.ajax({ type: 'POST', dataType:'json', url: siteurl+'functions_ajax/check_all_Ukraine', RE: 404 how make a rote - InsiteFX - 01-17-2018 @ XtreemDeveloper Note: base_url() and site_url() are not the same thing. base_url() = http://www.yoursite.com site_url() = http://www.yoursite.com/index.php RE: 404 how make a rote - badgershockeyfan - 03-28-2018 Every time I log onto this forum I find something helpful that I didn't even know I needed... thanks XtremeDeveloper and InsiteFX! |