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 6753991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:13:38+00:00 2026-05-26T13:13:38+00:00

I am trying to show information from database without reloading the page. I have

  • 0

I am trying to show information from database without reloading the page. I have a dropdown select option in my view, when I select any value, the dropdown only shows the table titles, but not the data from database. I tried hard to figure out the problem, but I failed.

And when users choose <option value="">Select a person:</option>, I want the jquery to send data to this controller- (test/index), but I don’t know how to do this.

Would you please kindly help me to solve these problems? Below is my jQuery, markup, and CodeIgniter code.

Inside Head:

<script type="text/javascript" src="<?php echo base_url(); ?>support/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript">

    $(document).ready(function() {

        $("select[name='users']").attr("selectedIndex", 1);

        $("select[name='users']").change(function() {
            var str = $(this).val();
            if( str == "" ) {
                $("#txtHint").html("");
            }
            else {
                $.get("<?php echo base_url(); ?>test/query/str", function(data) { $("#txtHint").html(data) });
            }
       }).change();
    });
</script>

Inside Body:

<form>
    <select name="users" >
        <option value="">Select a person:</option>
        <option value="11080101">Sumon</option>
        <option value="11080102">Donno</option>
    </select>
</form>
<br />
<div id="txtHint"><b>Person info will be listed here.</b></div>

My Controller :

function query($id){

    $sql="SELECT * FROM attendancein WHERE attendeeid = '$id'";

    $result = mysql_query($sql);

    echo "<table border='1'>
        <tr>
            <th>date</th>
            <th>In Time</th>
            <th>In Status</th>
            <th>Class Start Time</th>
        </tr>";

    while($row = mysql_fetch_array($result))
    {
        echo "<tr>";
        echo "<td>" . $row['date'] . "</td>";
        echo "<td>" . $row['intime'] . "</td>";
        echo "<td>" . $row['instatus'] . "</td>";
        echo "<td>" . $row['classstarttime'] . "</td>";
        echo "</tr>";
    }

    echo "</table>";
}  
  • 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-26T13:13:39+00:00Added an answer on May 26, 2026 at 1:13 pm

    As you probably understood, you’re not returning any data because the controller isn’t getting any arguments.

    I’m not completely familiar with routing in CodeIgniter, but it seems to be some flavour of REST. This is nice, but jQuery plays a little bit nicer with query strings than standard RESTful routing.

    But don’t worry. That only means that you have merge your query data into the url, instead of having jQuery send it using a query string.

    I think you want to do a jQuery get() like this:

    $.get(
      "<?php echo base_url(); ?>test/query/" + str,
      function(data) {
        $("#txtHint").html(data);
      }
    );
    

    This is assuming you have a route similar to this:

    $route['test/query/(:num)'] = yourController:

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

Sidebar

Related Questions

I have a CSV export script (enrdata_arch.php) which calls information from an existing database
Ok, so I am trying to extract the information from a cache.dat database sent
I am trying to get information from 3 tables in my database. I am
I have the following problem. I am currently trying to return information from a
I am trying to show the current date in my JSP page using JSTL.
I have a Dataset that contains tables from a university database, two(actually more) of
I have a database table that stores document information (DocID, Name, Type, Owner, etc).
I have a form that will be populated by a bunch of information from
I want to load json information from another page in my site with ajax.
I'm trying to use Django to display a table of information from across several

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.