last day (15 days later) » 

1:54 PM
0
Q: AJAX live search not working properly

user3400389Picture: My ajax live search is working all right with just having one problem. When i enter like 'C' it shows me the result in which c character occurs. but when i click 'Ce' then no search shows even when i have a word 'Certificate'. I don't know why this is happening. Help would be apprecia...

 
@ Steve its showing me Certificate of Deposit (CD)
@MackieeE yes it is case sensitive. I am using font-variant thats why every letter is capital.
@MackieeE updated my js above.
 
You wrote when i click 'Ce' then no search shows . At this moment, does the first results of 'c' disappear or stay?
 
@naota when i type 'c' result shows good. now when i press ce no results show. its exists in the database. Thats why Not found is not showing beacuse its exists.
@naota sometimes when i press x at that time no result is displaying. This is happening for some of the characters not all.
 
@user3400389, I would like to ensure that everytime you press a key, the ajax call is executed. In this case, when you type the second key 'e', is the ajax function surely fired ?
 
@naota yes with the help of the .on('input', function() its executed each time when i press a key. is this .on() is good to use?
 
1:54 PM
@user3400389, I guess you can also use .keyup(). But this might not be the main problem.
 
@naota yeah i don't know whats causing this. can you help me with the clicked problem? when click on a particular search result i get that word onto the input box field?
i just want to put the selected word onto the input box
like in google search
 
@user3400389, I can't understand the meaning of 's' 'sss' 'dss' ... Could you explain about it?
 
like when i press 'c' all the results show which contain 'c' in them right?
when i click any word in the result i get that word in the input box
 
Does this mean you have two problems? 1. empty result at scond key. 2. After clicking result.
 
yes thats right i have two problems
 
2:03 PM
I understand. Thanks.
 
no problem :)
 
The line, url: 'Reports/Account Search.php', is correct? There is a space between 'Account' and 'Search'.
 
Yeah this correct. My file also contain a search too.
thats my filename: 'Account Search.php'
 
Have you ever used debugging function console.log() ? This is very useful.
 
i tried it but i think that didn't work for me. can you tell me how to use this?
 
2:17 PM
You can see the value of variable like this
var GetAccountInput = document.getElementById("ChangeAccountInput").value;
console.log(GetAccountInput);
 
ok i wll check this now
 
You need to open console window of your browser
 
okay
 
You can also see the results.

success: function(data){
console.log(data);
$('#results').html(data);
}
 
it will show me an alert?
 
2:23 PM
No
 
then?
 
You can see about console.log here:stackoverflow.com/questions/7654863/…
You can see the value of variable in the console window of your browser.
 
i press 's' in the input box and got this in the console
color="white">Basic Checking</font><br><div id='hoverrow' style='border: 1px solid #AAAAAA; margin-left: -4px'></div></a><a href='#'><font
color="white">sssdsdxxz</font><br><div id='hoverrow' style='border: 1px solid #AAAAAA; margin-left: -4px'></div></a>
 
do you think it's correct ? It seems to much text.
 
its correct this is causing because for each result this function is running.
    while($row = oci_fetch_array($query))
    {
        echo "<a href='#'>";
        echo '<font color="white">'.$row['ACCOUNT_TYPE'].'</font>';
        echo '<br>';
        echo "<div id='hoverrow' style='border: 1px solid #AAAAAA; margin-left: -4px'></div>";
        echo "</a>";
    }
 
2:35 PM
how about second key input?
 
No Result Found
this is what showing
 
can you see the value of getAccointInput?
 
in the search ? or in the console?
 
in the console
it should be 'c' or 'ce'
 
yes
c
ce
 
2:47 PM
please give me a moment
 
okay no problem take your time
 
it's 23:51 in Japan and I'm on the train
 
ohh you are in japan. I love japan :) i love animes <3. you can help me some other time when u will be free. you just take care yourself right now.
 
Do you know how to handle error of Ajax call? if not see here stackoverflow.com/questions/1637019/…
I'm grad you love Japan!
 
no i don't know. I will check that.
 

last day (15 days later) »