这是我的javascript代码...我在我的控制器中编写了一个函数,如果返回false,那么我将回显“userNo”,否则回显json..这是我的javascript,其中只有else部分有效,而不是如果部分......我也签入了萤火虫..我得到一个响应“userNo”但不知道为什么它没有运行第一部分
    <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>
我的控制器
    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);
    }
}