• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

help me to solve this problem in my site i realy need some help

rozbeh1212

Active member
Feb 28, 2020
109
26
28
parseoban.ir
Hi guys

im working on ajax live search with php and jquery for this site http://fishopping.ir/search/,
when i type something in the search bar its show the results correctly but the website get 5089997a-7afd-46f0-8f6e-6c63dc764098.jpg messy get messy



it should be like this 31593a12-c3ad-4a77-8ddf-e41b970d7a0f.jpg


this is my source

please help me

<!DOCTYPE html>
<html >
<head>
<title>jquery autocomplete search using php mysql and ajax</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<style>
ul{ list-style: none; padding: 0px; width: 100%; padding-right: 5%;position: absolute;margin: 0; }
ul li{ background:#D3DCE3;padding: 4px;margin-bottom: 1px;}
ul li:nth-child(even){ background:#E5E5E5; color: white; }
ul li:hover{ cursor: pointer; }
</style>
<script type="text/javascript">
$(document).ready(function(){
$("#txtSearch").keyup(function(){
var search = $(this).val();
if(search != ""){
$.ajax({
url: 'http://fishopping.ir/search/productsearch.php',
type: 'post',
data: {search:search},
dataType: 'json',
success:function(response){
var len = response.length;
$("ul").empty();

$("ul").append("<table id='tblt' style='text-align:center' class='table table-striped table-bordered bootstrap-datatable datatable'><thead><tr > <th style='text-align:center'>نام </th></tr></thead><tbody></tbody></table>");

for( var i = 0; i<len; i++){
$("ul").append("<li>"+response['name']+"</li>");

}
}
});
}
});
});
</script>
</head>
<body>
<div class="container auto">
<div class="row" style="margin-bottom:10px;">
<div class="col-lg-12"><h2 style="text-align:center;"> موتور جستجوی کالا</h2></div>
</div>
<div class="form-group row">
<div class="col-lg-3">&nbsp;</div>
<div class="col-lg-6">
<label for="txtSearch">نام کالای مورد نظر خود را وارد کنید:</label>
<input type="text" charset="utf-8" class="form-control" id="txtSearch" name="txtSearch">
<ul></ul>
</div>
<div class="col-lg-3">&nbsp;</div>
</div>
</div>
</body>
</html>
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock