We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,849 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

auto complete

hi,

i have been struggling to find a good autocomplete script with mysql backend.

i now have an easy to use one and all is working, however in my page after the search has been typed and user selected instead of the users name appearing in the search box i want it to go to that users profile.

so go to url: users_detail.php?uid=

however i am not sure what i need to do in the javascript for this to happen:

<script type="text/javascript">
$(function(){
$(".search").keyup(function() 
{ 
var inputSearch = $(this).val();
var dataString = 'searchword='+ inputSearch;
if(inputSearch!='')
{
    $.ajax({
    type: "POST",
    url: "search.php",
    data: dataString,
    cache: false,
    success: function(html)
    {
    $("#divResult").html(html).show();
    }
    });
}return false;    
});

jQuery("#divResult").live("click",function(e){ 
    var $clicked = $(e.target);
    var $name = $clicked.find('.name').html();
    var decoded = $("<div/>").html($name).text();
    $('#inputSearch').val(decoded);
});
jQuery(document).live("click", function(e) { 
    var $clicked = $(e.target);
    if (! $clicked.hasClass("search")){
    jQuery("#divResult").fadeOut(); 
    }
});
$('#inputSearch').click(function(){
    jQuery("#divResult").fadeIn();
});
});
</script>

many thanks

2
Contributors
2
Replies
6 Days
Discussion Span
3 Months Ago
Last Updated
4
Views
Question
Answered
mrhankey
Junior Poster
110 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

you want redirect to a page from javascript maybe?

window.location.replace('url...');
SPeed_FANat1c
Posting Pro in Training
488 posts since Apr 2010
Reputation Points: 13
Solved Threads: 17
Skill Endorsements: 0

added in the link in php file around the results in repeat array.
thanks

mrhankey
Junior Poster
110 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 3 Months Ago by SPeed_FANat1c

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.2954 seconds using 2.75MB