【发布时间】:2021-04-10 10:28:46
【问题描述】:
我正在尝试将文本字段中的数据获取到我的 ajax 请求中,以便我可以从 API 获得响应。但是我对JS的经验很少,所以我无法弄清楚。
我正在使用物化框架。
HTML:
<div class="input-field">
<label for="country">Autocomplete</label>
<input type="text" id="country" class="autocomplete">
</div>
JS:
$(document).ready(function() {
//Autocomplete
$(function() {
$.ajax({
type: 'GET',
url: 'https://sandbox.iexapis.com/stable/search/**{I need the text from what the user has put in here}**?token='myiextoken',
success: function(response) {...
【问题讨论】:
标签: javascript ajax materialize