1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
$(document).ready(function(){
/*
######################## Search Start #############################
*/
$('.recepients').keyup(function(){
var dataString = $('form.sendPM').serialize();
/*
var min_length = 3; // min caracters to display the autocomplete
var keyword = $('.search_key').val();
if (keyword.length >= min_length) {
*/
$.ajax({
type: "POST",
url: "Admins/autoSuggestCheck.php",
data: dataString,
dataType: "json",
success: function(data) {
var hrefRes = '<a class="clickIt" id="'+data.getRes+'">'+data.getRes+'</a>';
$('.suggestion').find('a').click(function(){
alert(1);
});
$('.suggestion').html(hrefRes).show();
//$('.suggestion').text(data.getRes).show();
/*
if(data.getList){
//alert(data.getList);
// remove previous values from the list
$('.search_list').hide();
$('.search_list').html(data.getList).show();
} // end if(data.getList){
*/
} // end function
});
//} // end if (keyword.length >= min_length) {
return false;
}); // end keyup
$('.clickIt').click(function(){
alert('click');
var getID = $(this).attr('id').trim();
//console.log(getID);
alert('id '+getID);
var getVal = $('a').attr('href');
alert('val '+getVal)
$('.recepients').val(getID).text;
return false;
});
}); |
Partager