jQuery kodunuzdaki search işleminden sonra bir virgül koyup aşağıdaki kodu altına ekleyin;
response: function(event, ui) {
if (ui.content.length === 0) {
$("#sonucyok").html('<a href="adres">Kayıt yok, eklemek için tıkla</a>');
} else {
$("#sonucyok").empty();
}
}sonucyok diye bir id li div tanımlayıp gerekli işlemleri yapabilirsiniz.
Çok teşekkür ederim. Harika oldu. Bu koda ilave olarak arama yaptığım kişi yoksa ismi kopyalamak ikinci bir form daha var ana sayfada ona yapıştırmak istiyorum. lakin kopyalamak nasıl oluyor bu konuda bir fikrim yok araştırdım session komutu ile yapılıyormuş.
formun tamamı şöyle;
<?php include("baglanti.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Teknik V1</title>
<script src="jquery/jquery-1.11.3.min.js"></script>
<script src="jquery/jquery-ui.min.js"></script>
<link rel="stylesheet" href="jquery/jquery-ui.css"/>
<script>
$(function(){
var $search = $('#search');
$search.autocomplete({
source: 'kapi.php',
focus: function(event, ui){
$search.val(ui.item.mus_telefon);
},
select: function(event, ui){
// window.location.href = 'https://www.google.com/#q=' + ui.item.mus_adi;
$('#telefon').val(ui.item.mus_telefon);
$('#mus_id').val(ui.item.mus_id);
},
response: function(event, ui) {
if (ui.content.length === 0) {
$("#sonucyok").html('<img src="images/addcontact.png" width="25" height="25" style="margin-bottom:3px;" title="Müşteri Yok, Müşteri Ekle">');
} else {
$("#sonucyok").empty();
}
}
});
$search.data('.ui-autocomplete-loading')._renderItem = function( ul, item ){
return $li.appendTo(ul);
};
});
</script>
<script type="text/javascript">
function kCap(iO){
iO.value = iO.value.replace(/([\wöçşğüıİ])/gi,
function(a, b){return b.replace("I","ı").toLowerCase()}).replace(/(^[a-zöçşğüı]|[\s][a-zöçşğüı])/g,
function(c, d){return d.replace("i","İ").toUpperCase()});
}
</script>
<style>
body {
}
#genel {
width:800px;
height:600px;
margin:0 auto;
}
#form {
//margin-left:300px;
margin-top:30px;
}
#form label {
float:left;
padding:5px;}
#sonucyok {
margin-left: 512px;
margin-top: -395px;
}
//* search *//
#search {
width: 300px;
}
.ui-autocomplete li a {
overflow: hidden;
display: block;
}
.ui-autocomplete li a img {
float: left;
margin-right: 10px;
height: 40px;
}
.ui-autocomplete li a .username {
display: block;
font-size: 12px;
line-height: 17px;
background-color:#000;
}
.ui-autocomplete li a .email {
display: block;
font-size: 12px;
color: #999;
}
.ui-autocomplete-loading {
background: #fff url(ajax-loader.gif) no-repeat 97%;
}
//* search *//
</style>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.css">
<link rel="stylesheet" href="css/poppy.css">
<script src="css/poppy.js"></script>
</head>
<body>
<div id="genel">
<?php
$tarih = date("d.m.Y"); // Geçerli sistem tarihini almak için
$saat = date("H:i:s"); // Geçerli sistem saatini almak için
echo "Tarih : ".$tarih." - ";
echo "Saat : ".$saat;
?>
<script>
function Sayi(e) {
islem = document.all ? window.event : e;
karakter = document.all ? islem.keyCode : islem.which;
if(karakter<48||karakter>57) {
if(document.all) { islem.returnValue = false; } else { islem.preventDefault(); }
}
}
function Harf(e) {
islem = document.all ? window.event : e;
karakter = document.all ? islem.keyCode : islem.which;
if(karakter>=48&&karakter<=57) {
if(document.all) { islem.returnValue = false; } else { islem.preventDefault(); }
}
}
</script>
<form style="border:6px solid #00E7FF;" id="form" name="form" method="post" action="gonder.php">
<label for="textarea"></label>
<table width="800" border="0">
<tr>
<td colspan="3"><strong>Teknik Servis Kayıt</strong></td>
</tr>
<tr>
<td width="156"> </td>
<td width="9"> </td>
<td width="376"> </td>
</tr>
<tr>
<td><strong>Adı Soyadı</strong></td>
<td><strong>:</strong></td>
<td><label for="mus_adi"></label>
<input name="mus_id" id="mus_id" type="text" size="25" hidden="visible" />
<input onkeypress="Harf(event)" name="mus_adi" id="search" value="" type="text" size="25" onkeyup="kCap(this);" title="Lütfen Müşteri Adı Yazınız!" required style="border:2px inset #00E7FF; padding:5px; margin-bottom:5px; "/>
</td>
</tr>
<tr>
<td><strong>Telefon</strong></td>
<td><strong>:</strong></td>
<td><label for="mus_telefon"></label>
<input onkeypress="Sayi(event)" name="mus_telefon" maxlength="11" title="Lütfen Telefon Numarası Yazınız!" type="text" id="telefon" size="25" value="" required style="border:2px inset #00E7FF; padding:5px; margin-bottom:5px; "/></td>
</tr>
<tr>
<td><strong>Tarih</strong></td>
<td><strong>:</strong></td>
<td><label for="tarih"></label>
<input name="tarih" type="type" id="tarih" disabled="disabled" size="25" value="<?php echo "$tarih"; ?>" style="border:2px inset #00E7FF; padding:5px; margin-bottom:5px;" />
<input name="tarih" type="type" id="tarih" hidden="visible" size="25" value="<?php echo "$tarih"; ?>" style="border:2px inset #00E7FF; padding:5px; " /></td>
<input name="saat" type="type" id="saat" hidden="visible" size="25" value="<?php echo "$saat"; ?>" style="border:2px inset #00E7FF; padding:5px; " /></td>
</tr>
<tr>
<td><strong>Not</strong></td>
<td><strong>:</strong></td>
<td><label for="nott"></label>
<textarea name="nott" id="nott" cols="40" rows="3" style="border:2px inset #00E7FF; padding:5px; margin-bottom:5px;"></textarea></td>
</tr>
<tr>
<td><strong>Arıza</strong></td>
<td><strong>:</strong></td>
<td>
<div style="padding:6px; font-weight:bold;">Lütfen Bir Arıza Bildirin!</div>
<input type='checkbox' name='ariza[]' value='Arıza Tespit' />Arıza Tespit</input></br>
<input type='checkbox' name='ariza[]' value='Bilgisayar Açılmıyor' />Bilgisayar Açılmıyor</input></br>
<input type='checkbox' name='ariza[]' value='Şarj Aleti Var' />Şarj Aleti Var</input></br></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><table width="345" border="0">
<tr>
<td width="222"> </td>
<td width="98"><input class="btn btn-primary" type="submit" name="submit" id="submit" value="Kayıt Ekle" style="margin-bottom:5px;" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
<div style="margin-top:10px; padding:5px;"> <button class="btn btn-primary">J Müşteri Ekle</button> <a href="musterikayit.php" class="btn btn-primary">Müşteri Ekle</a> <a href="goster.php" class="btn btn-primary">Kayıtları Gör</a></div>
<div id="sonucyok"></div>
</div>
<div class="poppy" id="popup-1">
<form style="border:6px solid #00E7FF; margin-top:15px;" id="form" name="form" method="post" action="musterigonder.php">
<label for="textarea"></label>
<table width="800" border="0">
<tr>
<td colspan="3"><strong>Müşteri Kayıt</strong></td>
</tr>
<tr>
<td width="156"> </td>
<td width="9"> </td>
<td width="376"> </td>
</tr>
<tr>
<td><strong>Adı Soyadı</strong></td>
<td><strong>:</strong></td>
<td><label for="mus_adi"></label>
<input id="add" name="mus_adi" type="text" size="25" onkeyup="kCap(this);" title="Lütfen Müşteri Adı Yazınız!" required style="border:2px inset #00E7FF; padding:5px; margin-bottom:5px"/>
</td>
</tr>
<tr>
<td><strong>Telefon</strong></td>
<td><strong>:</strong></td>
<td><label for="mus_telefon"></label>
<input name="mus_telefon" maxlength="11" title="Lütfen Telefon Numarası Yazınız!" type="text" size="25" value="" required style="border:2px inset #00E7FF; padding:5px; margin-bottom:5px"/></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><table width="345" border="0">
<tr>
<td align="right" width="222" ><input class="btn btn-primary" type="submit" name="submit" id="submit" value="Müşteri Ekle" style="margin-bottom:5px;"/></td>
<td width="98"></td>
</tr>
</table></td>
</tr>
</table>
</form>
</div>
</body>
<script>
$("button").poppy("popup-1");
$("#sonucyok").poppy("popup-1");
</script>
</html>