mizzievie 0 Newbie Poster

I have the fields of three. There are Criteria, Line, and Customer.
I use CodeIgniter as my php framework.
In this case, if I want to choose Line fields (dropdown), I have to choose Criteria first, the line fields is disabled until I have criteria choosen. The same thing as Line, if I want to choose Customer, I have to choose Line first, the customer fields is disabled until I have line choosen.
So, I have to do these things : Choose Criteria -> Line -> Customer

But I have a problem in using .change(function()) from javascript, I couldn't find a way to send 2 parameters (criteria choosen and line choosen) to get Customer dropdown. These 2 parameters will be sent to controller that will process function getCustomerList($criteria, $line) from model.
Guide me please. Thanks a lot!
Here's the code:

<tr bgcolor="#ffffff" align="left">
									<td>&nbsp;Criteria:</td>
<tr>
  <td><div id="criteria" style="width:250px;float:left;">
    <?php
	echo form_dropdown("criteria_id",$option_criteria,"","id='cd_criteria'");
    ?></div>
  </td>
</tr>

<tr bgcolor="#ffffff" align="left">
  <td>&nbsp;Line:</td>
  <td><div id="line">
    <?php
	echo form_dropdown("line_id",array('Choose Line'=>'Choose Criteria First'),'','disabled');
    ?></div>
  </td>
  <script type="text/javascript">
      $("#cd_criteria").change(function(){
	var cd_criteria = {cd_criteria:$("#cd_criteria").val()};
	$.ajax({
	   type: "POST",
	   url : "<?php echo site_url('FORM/master_assy_form/select_line')?>",
	   data: cd_criteria,
	   success: function(msg){
           $('#line').html(msg);
	   }
        });
      });
  </script>
</tr>

How I create .change(function()) for Customer? :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.