SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Typing speed affecting AJAX Request

    Hi:

    I have a text box. When user types in it, it does a query and shows the result (alternative to drop down with AJAX)

    The problem is, if user types a bit faster it doesn't do the enquiry.

    I am doing
    HTML Code:
    <input type="text" name="id_originator_label" value="{$POST.id_originator_label}" class="text" id="id_originator_label"   onkeyup="serial_onchange(this,getRefById('id_originator'), 'serial_results3', '{$ajax_js_dir}/persons/persons_onchange.php','',0,',');" />
    		<div id="id_originator_maindiv" style="position:absolute;top:115px;right:25px;width:200px;height:300px;border:none;display:none;">
    			<iframe id="id_originator_iframe" frameborder="0" style="position:absolute;top:0px;left:0px;width:200px;height:300px;"></iframe>
    			<div id="serial_results3" class="ajaxdropdown" />
    			</div>
    		</div>
    			<input type="text" name="id_originator" value="{$POST.id_originator}" class="text" id="id_originator" style="display:none;" />
    			
    Some things I manually changed in the JS script to fit my needs (fields like id_originator_search or id_originator_iframe have special purposes.


    Again, it works fine if i type in slowly.
    ---------------------------
    Errors = Improved Programming.
    My Site

  2. #2
    SitePoint Addict CommanderZ's Avatar
    Join Date
    Apr 2006
    Location
    Czech Republic
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should put there a slight delay there (look for javascript timers) or you may perform the query for example every 5 typed characters.

  3. #3
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How would a timer work there?

    and i can't use 5 character method because it fetches users by first name and some are 2 character long (like Chinese names).
    ---------------------------
    Errors = Improved Programming.
    My Site


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •