I am creating a search box using Flask, MySQL, and ajax.
I am getting the JSON format of search results in the console but I want to append it on my option value in datalist in my HTML.
Here is the HTML -
Search
Here is my ajax code -
$(document).ready(function(){
$("#searchbox").on("input", function(e){
searchtext = $("#searchbox").val();
$.ajax({
method:"post",
url:"/searchengine",
// data:{backendname:valueName}
data:{text:searchtext},
success:function(res){
console.log(res);
//What Should I Do I Don't Know
}
})
});
})
Here is the Result Data in Console (in JSON Format) -
0: {address: "Delhi NCR"}
1: {address: "Dhar"}
length: 2
__proto__: Array(0)
I want to add address value in datalist in my HTML .
Thank you so much in advance.