问题是:它在第一个环境中加载选定的索引值。
它不会在第二个 MVC codeigniter 中发送它。控制器没有获得加载之前发送的选定索引。
第一个作品:看是多么容易理解。
//jquery code for source list
$(document).ready(function()
{
$('#sel_pais').change(function()
{
if ($(this).val()!='')
{
$("#sel_source").load("includes/getchilds5.php",{pais_id: $(this).val()});
}
});
}); // end of first function
=========================================================
getchilds5.php file
if(isset($_REQUEST['pais_id']) && !empty($_REQUEST['pais_id'])) {
$result = mysql_query("select * from tabla_from where pais_id='".$_REQUEST['pais_id']."' ");
if(mysql_num_rows($result) > 0) {
echo '<option value="">Select</option>';
while($row = mysql_fetch_assoc($result)) {
echo '<option value="'.$row['id_from'].'">'.$row['from_name'].'</option>';
}
} else {
echo '<option value="">Select</option>';
}
} # end of IF ISSET FOR PAIS
======= 现在 MVC 不起作用,因为控制器没有获取到值:
$(document).ready(function()
{
$('#country').change(function()
{
if ($(this).val()!='')
{
$("#source").load("/CI-3/application/controllers/control_form.php/",{pais_id: $(this).val()},
}
});
}); // end of first function
</script>
============================================================
<?php echo form_open('control_form/add_all'); ?>
<label for="country">Country<span class="red"></span></label>
<select id="country" name="country">
<option value="">Select</option>
<?php
foreach($result as $row)
{
echo '<option value="' . $row->pais_id . '">' . $row->pais_name . '</option>';
}
?>
</select>
<label for="source">Source Language<span class="red"></span></label>
<!--this will be filled based on the tree selection above-->
<select id="source" name="source">
<option value="">Select</option>
<?php
===============================================================
控制器会这样做:
$pais_id = $this->input->get_post('country', TRUE); # but I am not getting anything
但它得到一个空对象