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

  • Home
  • SEARCH
  • 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 8311211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:44:11+00:00 2026-06-08T19:44:11+00:00

I am working on a form where a user can select a letter from

  • 0

I am working on a form where a user can select a letter from A – Z to select a list of users whose username begins with that letter.

What i am trying to do is when the user clicks a letter, a php script is called to do a database query that pulls any username which begins with the clicked letter.

I have found this page which has started me off http://openenergymonitor.org/emon/node/107 and also this one which is closer to what i want to do Simple Ajax Jquery script- How can I get information for each of the rows in the table?

What i want to do with the returned results is put them in a SELECT list and also when a user click a different letter, that list contents is replaced with the new query results.

What i’m not sure is how to and if possible pass the letter to the php script so i can search the database for usernames that begin with that letter.

EDIT: I have got it hopefully improved to this but i’m getting Ajax error: ParseError

this is my code so far

<div>
        <ul>
            <li class="alphabets" id="All">All</li>
            <li class="alphabets" id="A">A</li>
            <li class="alphabets" id="B">B</li>
            <li class="alphabets" id="C">C</li>
            <li class="alphabets" id="D">D</li>
    </ul>
</div>
<div id="recipients">
    $(document).ready(function(){
                $("li.alphabets").click(function(){
                    var the_letter = $(this).text();
                    alert(the_letter);

                    $.ajax({                                      
                        url: 'php/selectuser.php', type: 'GET', data: {'letter':the_letter}, dataType: 'json',  success: function(rows) {
                            var options = '';
                            for (var i in rows) {
                                var row = rows[i];          
                                var id = row[0];
                                var vname = row[1];

                                options += '<option value="' + id + '">' + vname + '</option>';
                            } 
                            $("#userlist").html(options);
                        } 
                    });
                });
            });
    <select id="userslist" name="recipients" size="5">



    </select>
</div>
  • 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-06-08T19:44:13+00:00Added an answer on June 8, 2026 at 7:44 pm

    jQuery’s .ajax() method has a parameter called data which allows you to pass variables:

    // Get letter from SELECT element
    the_letter = $("#myselect").val();
    
    $.ajax({ 
      url:  'somepath/to/my/script.php',
      type: 'GET',
      data: {'letter':the_letter} 
    });
    

    It is passing it as a GET parameter, easily retreivable in your PHP script with:

    $letter = $_GET['letter'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on web form which collects certain user information from users and
I have a form where a user can select a rating from 1-5. Each
I have a user form that is working perfectly. The page makes use of
I am working on a PHP form that allows a user to add rows
Im trying to get a form working in Internet Explorer. I see that when
I'm working with a form that I've altered from another site I created, which
I'm currently working on a project involving a form generator. The user can switch
I have a form that the user can save and return to edit. I
I have a form where users can subscribe and unsubcribe to my email list.
I am working on a simple news module. There is a form where user

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.