When i check some league, i want to load seasons from database what i have for that league.
I tried this code.
test.php view
<script type="text/javascript">
$(document).ready(function () {
var site_url = "<?php echo base_url('/system/getseasons/SC0'); ?>"; //SC0 is here as example, there will be selected league
$("#season").load(site_url);
});
</script>
System.php controller
public function getseasons($div){
$seasons = $this->sys_model->getseasonsforleague($div);
$mode = '';
foreach($seasons->result() as $season){
if($season->Season != ''){
$newseason = $this->season_filter($season->Season);
if($mode == 'edit' and $system->bet_venue !== NULL){
$season_arr = explode(";",$system->seasons);
foreach($season_arr as $seas){
if($season->Season == $seas){
echo "<input type='checkbox' name='season[]' checked='checked' value=". $season->Season .">" . $newseason . "</input><br>";
}
}
if($season->Season != $seas){
echo "<input type='checkbox' name='season[]' value=". $season->Season .">" .
$newseason . "</input><br>";
}
}
else{
echo "<input type='checkbox' name='season[]' value=". $season->Season .">" . $newseason . "</input><br>"; }
}
}
}
NOTE: this controller 100% works because when i manually go to this link: site.com/system/getseasons/SC0 i get all seasons for SC0 league.
and Sys_model.php model
public function getseasonsforleague($div){
$this->db->select('Season');
$this->db->where('Div',$div);
$this->db->group_by('Season');
return $this->db->get('historic');
}
When i check browser Console i see 404 error:
GET https://www.example.com/system/getseasons/SC0 404 (OK)send @ jquery.min.js:5m.extend.ajax @ jquery.min.js:5m.fn.load @ jquery.min.js:5(anonymous function) @ test:11j @ jquery.min.js:2k.fireWith @ jquery.min.js:2m.extend.ready @ jquery.min.js:2J @ jquery.min.js:2
But one more time, this link works:
Also i tried this:
var site_url = "<?php echo base_url('/index.php/system/getseasons/SC0');
but again 404.