Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 509809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:02:57+00:00 2026-05-13T07:02:57+00:00

So i’v been going though the tutorial on: http://jqueryfordesigners.com/play-school-easy-ajax-load/ (site seems a bit slow

  • 0

So i’v been going though the tutorial on: http://jqueryfordesigners.com/play-school-easy-ajax-load/ (site seems a bit slow at the moment BTW)

I’v tried using:

if(this.value.length > 0) {

But it doesn’t seem to work.
When I type something into the input forum it will load the test1.php every time even if I just press say shift. (this is not what I want, I want it to only refresh if I type in a actual letter or number)

The main javascript I’m working with:

$(document).ready(function () {
    $('#name').keyup(function () {
      // if(this.value.length > 0) {
        $('#results ul').load(
            'test1.php #results li'
          , { name : this.value }
        );
      // }
    });
});

Any pointers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:02:57+00:00Added an answer on May 13, 2026 at 7:02 am
    $(document).ready(function () {
      $('#name').keyup(function () {
        // console.log(this.value);
        if(this.value.length > 0) {  
          $('#results ul').load('test1.php #results li', { name : this.value });
        }
       });
    });
    

    Should work. Try adding some alert("test"); here and there and seeing when they pop up. Or use firebug to step through the code executing.


    Edit

    It seems you want it to only load the page if an actual character key is pressed. There are several ways to do this, but the simplest method is probably to compare the value of the box to the previous value, the one it had before the key was pressed:

    $(document).ready(function () {
      $('#name').keyup(function () {
        if(this.value != $(this).attr("data-old-value") && this.value.length > 0) {  
          $(this).attr("data-old-value", this.value);
          $('#results ul').load('test1.php #results li', { name : this.value });
        }
       });
    });
    

    This will only work if you use keyup (tested in firefox).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I been going through this tutorial http://www.codeproject.com/KB/linq/BulkOperations_LinqToSQL.aspx and them make a SP like this
I've been going through a bit of the lemur indexing tutorial here: http://www.lemurproject.org/tutorials/begin_indexing-1.php I've
Lately, I've been going through a pretty weird phase. I feel the need to
I have been tasked with going through a number of ColdFusion sites that have
Been going over my predecessor's code and see usage of the request scope frequently.
I have been going back and forth between C# and Java for the last
I've been going over and over this in my head, and I can't seem
I've switched over to a Mac recently and, although things have been going quite
We've been using Trac for task/defect tracking and things were going well enough, but
I've been working on a ASP.NET project that is going to save uploaded files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.