我如何将值从javascript传递到php实时

时间:2012-06-07 18:25:09

标签: php javascript ajax jquery

  

可能重复:
  jQuery and PHP suggested answers
  auto suggest ajax for php

我想使用javascript将值从textfield传递到php文件。以下是代码。在这里你可以看到一个文本字段和一个javascript。在javascript中检查该行  来源:“test.php”,这里我想将数据传递给php。

<form id="form1" name="form1" method="post" action="#">

<input type="text" name="Tag" id="Tag" />

</form>
 $('#Tag').jSuggest({
    uniqID: 'id',
    source: "test.php", //TOGETHER WITH THIS URL I WANT TO PASS VALUE FROM TEXTBOX NAMED "TAG" TO A VARIABLE IN TEST.PHP NAMED "REQ"
   // preFill: pref.items,
    selectedItemProp: "name", 
    seekVal: "name",
    queryLimit: 10,
    newItem: function (item){ var newItemData = {value: item, name: item}; return newItemData;},
    selectionLimit: 2,
    formatList: function(data, elem){elem.html(data.name); return elem;},
    selectionAdded: function(elem, data) {
      console.log(data.name);
    },
    selectionRemoved: function(elem, data) {
      console.log(data.name);
      elem.remove();
    }

 });

0 个答案:

没有答案