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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:36:24+00:00 2026-06-17T21:36:24+00:00

i am beginner in a code igniter and jquery. i have a textbox in

  • 0

i am beginner in a code igniter and jquery. i have a textbox in which if user type some thing it displays the data in tooltip from the database.. here in my situation what i want is … i have a texbox named called “bill no”.. what i want is if a user enter bill no in a text box it displays the data against the bill no.. i dont know how can i pass data from controller to view in ajax and then after pass how to show in tooltip
here is my code

Bill No:<?php echo form_input($bill_no); ?>
<input type="hidden" class="hiddenUrl"><span class="checkbillno" data-trigger="manual"


     data-title="bill no" data-content="here i want to display results"></span> 

my javascript

<script type="text/javascript">

    $(document).ready(function(){

        $('#bill_no').blur(function(){

            if( $('#bill_no').val().length >= 3 )
                {
                  var bill_no = $('#bill_no').val();
                  getResult(bill_no); 
                }
            return false;
        })
        function getResult(billno){
            var baseurl = $('.hiddenUrl').val();
            $('.checkbillno').addClass('preloader');
            $.ajax({
                url : baseurl + 'Controller/checkBillNo/' + billno,
                cache : false,
                success : function(response){
                    $('.checkbillno').removeClass('preloader');
                    if(response == 'userOk')
                        $('.checkbillno').removeClass('preloader');
                    if(response == 'userOk') $('.checkUser').removeClass('userNo').addClass('userOk');
                    else $('.checkUser').removeClass('userOk').addClass('userNo');

                }
            })
        }
    })

here what i am doing is that it simply check the bill no in database and if it is available in the database then it adds the class “userok” otherwise “userfalse”.. and here what i want is display data as well as against the bill no..i know how to do this in model but dont know how can i pass from controller to ajax and then it shows the result in tooltip

my controller

function checkBillNo($billno){
    $this->load->model('returnModel');
    $query = $this->returnModel->checkBillNo($billno);

    if($query == 1 ) 
        $data['result'] = $query; //how can i pass this result into view in tooltip... (span class)

    else 
        echo 'userNo';

}
  • 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-17T21:36:25+00:00Added an answer on June 17, 2026 at 9:36 pm

    A useful way to manipulate data is to use json in your datatypes:

    function getResult(billno){
         var baseurl = $('.hiddenUrl').val();
         $('.checkbillno').addClass('preloader');
         $.ajax({
              url : baseurl + 'Controller/checkBillNo/' + billno,
              cache : false,
              dataType: 'json',
              success : function(response){
                   $('.checkbillno').attr('data-content', response.toolTip);
              }
         })
    }
    

    Now your js function expects a json encoded array as a response, so in your controller you could do something like the below:

    $forToolTip = '';
    foreach($query->result() as $row){
        $forToolTip .= $row->key;
    }
    
    $result['toolTip'] = $forToolTip;
    echo json_encode($result);
    

    Alter variables to match your concept

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

Sidebar

Related Questions

Does anyone have some useful beginner tutorials and code snippets for playing with basic
I'm a total beginner to HLSL and have got some sample code that renders
I am a beginner in Java Programming. My code encrypts data extracted from a
I'm a complete beginner with Code::Blocks and SQLite, and have some basic knowledge with
I am a beginner in MATLAB coding so I have taken code from else-ware
I am a beginner and writing code to display data in a Gridview using
Beginner in Android development. My code crashes. I have made a simple Java method
Question from beginner. Why code <%= System.DateTime.Now.ToLongDateString() %> is not executed in ASP.NET. Could
i am a beginner and i have a problem : this code doesnt compile
I'm a beginner with php and have created a code displaying a table with

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.