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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:37:48+00:00 2026-06-17T19:37:48+00:00

this is my javascript code …i have written a function in my controller in

  • 0

this is my javascript code …i have written a function in my controller in which if false is return then i am echoing the ‘userNo’ other wise echo the json .. here is my javascript in which only else part is working not if part … i have checked in firebug also .. i am getting a response “userNo” but dont know why it is not running the first part

    <script type="text/javascript">


    $(document).ready(function(){
         $('#hide').hide();
        $('#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();
           $('.check').addClass('preloader');
            $.ajax({
                url : baseurl + 'returnFromCustomer_Controller/checkBillNo/' + billno,
                cache : false,
                dataType: 'json',
                success : function(response){
                     $('.check').removeClass('preloader');

                    if (response == "userNo") //this part is not working
                        alert("true");
                    else
                    $('.check').removeClass('userNo').addClass('userOk');
                    // $(".text").html(response.result);
                     $('#hide').show();
                     $(".text1").html(response.result1);
                     $(".text2").html(response.result2);
                     $(".text3").html(response.result3);

                }
            })
        }
    })


  </script>

my Controller

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

    $query = $this->returnModel->checkBillNo($billno);

    //$billno =   $this->uri->segment(3);
    $billno_results  = $this->returnModel->sale($billno);

    if (!$billno_results){

            echo "userNo";


    }else{
        echo json_encode($billno_results);

    }




}
  • 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-17T19:37:49+00:00Added an answer on June 17, 2026 at 7:37 pm

    Instead of echo “userNO”, try to use it:

    echo json_encode(array('return' => 'userNo'));
    

    … and in your JS, use this:

    if (response.return == "userNo") { // ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This Javascript code is using the 'this' keyword inside a nested function (which is
i have this javascript code to which i want to add the jquery fade-in
I have this javascript code: function checkUploadedFile() { var inputFile = $(#fuUploadProfile).val(); if (inputFile
I have this JavaScript code: $(document).ready(function(){ $('#sel').change(function(){ $.ajax({ type: POST, url: modules.php?name=TransProject_Management&file=index, data: &op=index_stat&stat=+$(this).val(),
I have this javascript code which makes possible writing in a file { var
I have this javascript code: $(document).ready(function() { var leftHeight = $('#maincontent').height(); $('#sidemenu').css({'height':leftHeight}); }); This
I Have this JavaScript code to allow only numeric input on textboxes function CheckNumeric(e)
I have this JavaScript code in an ASPX page <script> function show_modal(statut) { if
Lets say i have this javascript code in an html pages <script type=text/javascript> $(document).ready(function(){
I have this JavaScript code: <script type=text/javascript> function timeMsg() { var t=setTimeout(doRedirect(),10000); } function

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.