【问题标题】:console.log native code error in google chrome and android browsersgoogle chrome 和 android 浏览器中的 console.log 本机代码错误
【发布时间】:2014-03-30 16:29:52
【问题描述】:

在用户单击注册按钮后,我使用以下功能显示数据。这在 Mozilla firefox 上运行良好,但在 Google chrome 和 Android 浏览器上出现本地代码错误,我错了?

    function postdata(){
var chkfrm = checkdata();
if(chkfrm == 0){
    var url = 'http://domain.com/index.php/Signup/signin';    
    $.ajax({
       type: "POST",
       url: url,
       data: $("#formI").serialize(), // serializes the form's elements.
       beforeSend:function(){
     $("#signupdiv").html('<img src="http://domain.com/images/signuploading.gif" />');
       },
       success:function(data)
       {
          $("#signupdiv").html(data);
       },
       error:function () {
            alert(console.log);      
       }
    });
    }
    else {
$("#msgjava").html('<p>We need a little bit information from you.Please fill it.</p>');
    return false;
}}

【问题讨论】:

    标签: javascript php jquery ajax


    【解决方案1】:

    console.log 是一个函数,你应该使用alert(something)console.log(something)

    error:function (data) {
        alert(data); // or console.log(data)      
    }
    

    【讨论】:

    • 我不擅长javascript的这段代码我应该在这里提醒什么
    • 返回给我[object Object]
    • @SPSingh 这意味着它是一个对象,所以你应该使用 console.log 并阅读控制台。仅对字符串、数字等使用 alert
    猜你喜欢
    • 1970-01-01
    • 2015-06-04
    • 2014-11-24
    • 2011-04-26
    • 2011-09-25
    • 1970-01-01
    • 1970-01-01
    • 2014-12-05
    • 1970-01-01
    相关资源
    最近更新 更多