我想使用 javascript 将值从文本字段传递到 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();
}
});