我是相當新的jQuery和會很感激一些幫助如下:插入來自輸入API URL的jQuery
我有一個輸入表單,允許用戶選擇3個不同的地理區域(國家,地區和城市)所有信息都來自API。我需要來自國家的輸入(如用戶類型)進入URL調用「城市」的API。這樣用戶只能獲得與該國相關的城市。
這是我有:
<input type="text" name="country" id="country" />
<input type="text" name="city" id="city" />
$(document).ready(function() {
$("#country").tokenInput("http://someurl.com/search?q=", {
method: "POST",
searchDelay: 0,
});
$("#city").tokenInput("http://someurl.com/search?q=[Insert values form country input field]", {
method: "POST",
searchDelay: 0,
});
});
的jQuery插件,我使用的是:this。
你使用插件,需要研究插件的API文檔以瞭解如何添加數據。發佈一個鏈接插件文檔 – charlietfl
嗨@charlietfl謝謝你。這裏是插件的鏈接:http://loopj.com/jquery-tokeninput/ –