我想放一个进度条在文本框中,使用自动完成plugin.To调用数据库中的所有信息,这个进度条将是show.Like你在图片中看到的
请看我现在的照片,请指导我。
<div class="col-md-6 ">
<label>شغل بیمه
<span style="color:red;margin-top:2px" >*</span>
</label>
<input class="form-control" type="text" id="SematYaShoghlBime" asp-for="@Model.person.SematYaShoghlBime" placeholder="جستجو کنید...">
<script>
$(document).ready(function () {
$("#SematYaShoghlBime").autocomplete({
source: function (request, response) {
$.getJSON("/Home/SearchInTaminJobs", {
term: $("#SematYaShoghlBime").val().trim()
},
response)
},
minLength:7,
});
});
</script>
[HttpGet]
public IActionResult SearchInTaminJobs()
{
string term = HttpContext.Request.Query["term"].ToString();
var query = _context.TaminJobs.Where(Ad => Ad.jobName.Contains(term)).Select(c => c.jobName + c.jobCode).ToList();
return Ok(query);
}
发布于 2021-08-10 18:47:10
这是一个你可以遵循的工作演示:
<input type="text" id="SematYaShoghlBime">
<img id="loading" style="display:none;width:30px;height:30px" src="https://bodhitreeyogaresort.com/wp-content/uploads/2019/02/loading_icon_sm.gif" />
@section Scripts{
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$(function () {
$("#SematYaShoghlBime").autocomplete({
source: function (request, response) {
$("#loading").show();
$.getJSON("/Home/SearchInTaminJobs", {
term: $("#SematYaShoghlBime").val().trim()
}, function (data) {
response($.map(data, function (el, index) {
return el;
}));
$("#loading").hide();
})
},
});
});
</script>
}
结果:
https://stackoverflow.com/questions/68727020
复制相似问题