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

rozbeh1212

Active member
Feb 28, 2020
110
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>
 

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu