jQuery('.ssp_input').keyup(function(){//keyup() var num = jQuery(this).val().length; //alert(num); if(num == 11){ var phone = $('#ssp_phone').val(); alert(phone); $.ajax({ type: "POST", url: '{php echo $this->createMobileUrl("judgephone");}', data: {phone:phone,type:1},//1表示话费 dataType: "json", success: function(data){ console .log(data);
alert(data); $('#resText').empty();   //清空resText里面的所有内容 $('#resText').text(data.area); var html = ''; if(data.valuelist.length!=0){
$('.chongzhi').prop('disabled', false);
$('.ssp_price').show();
$('.ssp_note').hide();
}else{
$('.chongzhi').prop('disabled', true);
$('.ssp_price').hide();
$('.ssp_note').show();
}
$.each(data.valuelist, function(commentIndex, comment){
console.log(commentIndex);//看到网页输出的内容 }); $('#PriceList').html(html); } }); }})

解决方案 »

  1.   

    报啥错?有alert(phone);吗?查看源文件,看看url: '{php echo $this->createMobileUrl("judgephone");}',有替换为提交地址没
      

  2.   

    没有报错,就是success: function(data){console .log(data);
    alert(data);
    这里没有弹窗,也没有控制台输出
      

  3.   

    浏览器 右键:查看源代码 看看 url: '{php echo $this->createMobileUrl("judgephone");}', 变成了什么
      

  4.   

    是不是后端没有输出,要注意后端输出,有的用return,有的要echo。
      

  5.   

    ajax url地址是否正确