2012-10-03 19 views
0

我有兩個JQuery UI自動完成輸入字段。 在第一個選項中選擇選項時,選擇的值將用作數據庫查詢的條件,該數據庫查詢將發送第二個自動填充字段的源數據。 我的問題是如何通過Post方法將第一個選擇的值發送到PHP頁面?通過Post方法從JQuery UI自動完成傳遞給PHP頁面

到目前爲止的代碼如下所示(此代碼是從使用GET方法的教程,但我想用郵報):

<script> 

          $("input#divisions").autocomplete ({ 
                 //this is the first input 
          source : [ 
             { value: "81", label: "City1" }, 
             { value: "82", label: "City2" }, 
             { value: "83", label: "City3" }          ], 
          minLength : 0, 
          select: function(event, ui) { 
           $('#divisions').val(ui.item.label); 

           return false; 
          }, 
          focus: function(event, ui){ 
          $('#divisions').val(ui.item.label); 
          return false;  
          }, 
          change: function(event, ui){ 
                   //the tutorial has this value sent by variables in the URL; I want the selection value sent by POST. How can I change this? 
           c_t_v_choices = "c_t_v_choices.php?filter=" + ui.item.value; 
           $("#c_t_v").autocomplete("option", "source", c_t_v_choices); 
          } 
          }).focus (function (event) 
          { 
          $(this).autocomplete ("search", ""); 
          }); 

          $("#c_t_v").autocomplete({ 
           source: "", 
           minLength: 2, 
           select: function(event,ui){ 
            //$('#city').val(ui.item.city);    
           } 
          }); 
</script> 

任何人都可以請幫助? 如果您有任何問題,請不要猶豫,讓我知道。

回答