weixin_33712881 2016-10-01 22:06 采纳率: 0%
浏览 36

Ajax中的多个变量

I am trying to send 2 variable from my comobox but is does not work, it only works when I send 1 here is the ajax code:

$(document).ready(function()
{
$(".clase").hide();
$(".ruta").change(function(){
var id=$(".rutas").val();
var dataString = 'id='+ id;
$.ajax
({
type: "POST",
url: "asientos.php",
data: dataString,
cache: false,
success: function(html)
{
        $(".clase").show();
       $(".clase").change(function(){
      var id=$(".rutas").val();
      var cla=$(".clase").val();
      var dataString = 'id='+ id;
     var data = 'cla'+ cla;
$.ajax
  ({
          type: "POST",
          url: "asientos.php",
          data: dataString,data,
         cache: false,
         success: function(html)
{
        $(".asientos").html(html);
}
           });
        });
       }
    }); 
  });
});

Now here is my html only showing the combo part cause i have multiple components in the form

<label class="ruta">Rutas </label> <select name="rutas" id="rutas" class="rutas" >
<?php   include 'rutas.php';   ?>
</select>
<label class="clase">Clases </label><select name="clase" id="clase" class="clase">
<option value="A">Clase Ejecutiva</option>;
<option value="B">Clase Media</option>;
<option value="C">Clase Economico</option>;
</select>

In the first combo I am Retrieving data from database and the second combo I inputted the data, now i need that both values from each combo save to the variables I have in my Php file in order to fill the third combo.

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 Android URL如何转成视频/音频,可行吗?
      • ¥20 SQL数据查询,子查询
      • ¥15 c++字符串分割问题
      • ¥15 关于#sql#的问题:没有用命令关闭cdc,手动把系统表开启的cdc右键删除了
      • ¥15 vue+uniapp
      • ¥15 android freedom
      • ¥15 使用自定义的类型代替内置类型可行吗
      • ¥15 关于STM32的SPI和ENDAT接口编码器通信的问题
      • ¥15 关于#pdfbox#生成的PDF文件正常,转图片中文乱码的问题,如何解决?
      • ¥15 ADS中有关DAC控件的使用问题