Hi I'm trying to pass the values from the link and use $_GET to receive the values. I've tried this on my local it works, but when I transferred it to a live site It won't receive the values of the parameters.
I've tried using firebug I can see the values are being stored in the link. But unable to $_GET them.
AJAX
function getDivUpdate(val) {
var group = $("#grp").val();
var div = $("#div").val();
$.ajax({
type: "GET",
url: "<?=base_url()?>personnel/get_division_update/",
data:{"group": group, "div": div},
success: function(data){
$('#div1').html(data);
}
});
}
PHP
function get_division_update($val=NULL){
if(isset($_GET['group'])){
$select = "d_divname,dr_division";
$table = "tbl_division";
$where = "dr_group = $_GET[group]";
$join1 = "tbl_division_rel";
$join2 = "d_id = dr_division";
echo "<select class='fieldnames' id='div' name='div'>";
echo "<option value=''>--Select--</option>";
$division = $this -> Main -> select_data($select, $table, $where, $join1, $join2);
foreach($division as $div){
echo '<option value="'.$div['dr_division'].'"';
if($div['dr_division'] == $_GET['div'])
{ echo "selected=selected"; } echo ">";
echo htmlspecialchars($div['d_divname']).'</option>';
}
}
else if(isset($_GET['div']) OR isset($_GET['group'])){
$table="tbl_division";
$select="*";
$orderby="d_divname";
$divs = $this -> Main -> dropdown_orderby($select, $table, $orderby);
echo "<select class='fieldnames' id='div' name='div'>";
echo "<option value=''>--Select--</option>";
foreach($divs as $d){
echo "<option value='".$d['d_id']."'>".$d['d_divname']."</option>";
}
}
else if(!isset($_GET['div']) AND !isset($_GET['group'])){
$table="tbl_division";
$select="*";
$orderby="d_divname";
$divs = $this -> Main -> dropdown_orderby($select, $table, $orderby);
echo "<select class='fieldnames' id='div' name='div'>";
echo "<option value=''>--Select3--</option>";
foreach($divs as $d){
echo "<option value='".$d['d_id']."'>".$d['d_divname']."</option>";
}
}
}
Is the request truly success, cause you need to echo out base url for getting path as base_url()
are returned the value, not printed the value, try change to below code :
url: "<?= echo base_url()?>personnel/get_division_update/",
// or
url: "<?= echo base_url('personnel/get_division_update/')?>",
Fixed the problem. I just changed the uri protocol of my codeigniter
FROM
$config['uri_protocol'] = 'QUERY_STRING';
TO
$config['uri_protocol'] = 'AUTO';