首页 > 解决方案 > 使用自动完成功能在 Jquery 中发送请求并获得响应?

问题描述

我正在尝试发送带有值的请求,Pubid:1, pubdate:"2021-02-14"但在发送请求后也没有任何工作,当响应获取时,我试图获取数据并在响应时运行jquery 自动完成

供参考,请检查我的界面并单击标题文本框我正在标题文本框中实现

<div class="input-group">
    <label class="label">Headline</label>
    <input class="input--style-4" type="text" id="head">
</div>

$( "#head" ).autocomplete({
    source: function (request, response) {
        $.ajax({
            type: "POST",
            url:"https://myimpact.in/deletearticle/services/articlelist.php",
            data: {term:request.term,Pubid:"1",pubdate:"2021-02-14"},
            success: response,
            dataType: 'json',
            minLength: 2,
            delay: 100
        });
    }
});

标签: jqueryrequest

解决方案


推荐阅读