What I have done is,
Ajax call return a combined value . I split and store them in a array .
I Give it to jquery auto-complete but it isn't working.
<script type="text/javascript">
window.onload=function Search_Items()
{
var action = "Search_Item";
$.ajax({
method:'GET',
url:'ajax_process.php',
data: {action:action},
success:function(result)
{
document.getElementById("Search_Result_Div").innerHTML=result;
var temp=document.getElementById("Search_Result").value;
availableProducts=temp.split("`");
$(function() {
var Product=$( "#tags" ).autocomplete({
source: availableProducts,
select: function (event,ui) {Load_Products(ui.item.value);}
});
});
}
});
};
$(document).ready(function() {
$("#tags").click(function() { $(this).select(); $('#ui-id-1').css('max-height','300px');$('#ui-id-1').css('overflow','auto');$('#ui-id-1').css('font-size','13px');} );
});
</script>
This is a HTML tag which is meant to be auto-complete,
<input type="text" class="product_input" style="width:100px;" id='tags'>
NOTE:
Thanks.
try replacing
$(function() {
var Product=$( "#tags" ).autocomplete({
source: availableProducts,
select: function (event,ui) {Load_Products(ui.item.value);}
});
});
with
var Product=$( "#tags" ).autocomplete({
source: availableProducts,
select: function (event,ui) {Load_Products(ui.item.value);}
});
I don't know why you are using your code inside
$(function() {
});
http://learn.jquery.com/using-jquery-core/document-ready/ as it stands for document ready which you have already written below.So try without it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.