简体   繁体   English

为什么我没有收到任何Firebug控制台响应信息?

[英]why I am not receiving any firebug console response stuff?

I have this ajax call in my external javascript file, and I am not getting any stuff from the firebug console, here's my code 我在外部javascript文件中有这个Ajax调用,但是从Firebug控制台没有得到任何东西,这是我的代码

   $.ajax({
      type: "POST",
      url: "classes/ajax.registerpopup.php",
      timeout: 8000,
      data: "userid="+userid+"&resumetitle="+resumetitle+"&resumeintro="+resumeintro+
            "&name="+name+"&dob="+dob+"&contacttel1="+contacttel1+"&contacttel1type="+contacttel1type+
            "&contacttel2="+contacttel2+"&contacttel2type="+contacttel2type+"&contacttel3="+contacttel3+
            "&contacttel3type="+contacttel3type+"&primaryemail="+primaryemail+"&secondaryemail="+secondaryemail+
            "&skype="+skype+"&facebook="+facebook+"&linkedin="+linkedin+"&twitter="+twitter+
            "&messenger="+messenger+"&yahoo="+yahoo+"&aol="+aol+"&summaryofpositionsought="+
            summaryofpositionsought+"&summaryofskills="+summaryofskills+"&gender="+gender,
      success: function(msg){
          if(msg == "success"){
            alert(msg);
           $('form#wsrecruitcvhead').fadeOut("normal",function(){
           $('div.successpost').fadeIn(1000);
          });
          } else {
            alert(msg);
          }
      },
      });
      return false;
         }

here's my php code 这是我的PHP代码

$sql = "INSERT INTO wsrecruitcvhead VALUES($userid,NULL,NULL,'$resumetitle','$resumeintro','$name','$dob','$contacttel1','$contacttel1type',
'$contacttel2','$contacttel2type','$contacttel3','$contacttel3type','$primaryemail','$secondaryemail','$skype','$facebook','$linkedin','$twitter',
'$messenger','$yahoo','$aol','$summaryofpositionsought','$summaryofskills','$gender',NOW(),NULL)";


if(mysql_query($result)){
  echo "success";
} else {
  echo "error".mysql_error();
}
  • Using alert won't show nothing on your firebug console, you must use console.log 使用alert不会在Firebug控制台上显示任何内容,您必须使用console.log
  • success parameter on $.ajax only works if no server errors occur, so if there is an error in your PHP code this method won't be called $.ajax上的success参数仅在没有发生服务器错误的情况下才有效,因此,如果您的PHP代码中有错误,则不会调用此方法

Update: Just to share some jQuery experience, given all your form fields have a name attribute you could use $.serialize to build this param1=value1&param2=value2 string. 更新:只是为了分享一些jQuery的经验,鉴于所有表单字段都有一个name属性,您可以使用$.serialize来构建此param1=value1&param2=value2字符串。 Check this link: http://api.jquery.com/serialize . 检查此链接: http : //api.jquery.com/serialize

This could be due to the fact that your call does not succeed. 这可能是因为您的通话未成功。 Have you tried adding: 您是否尝试添加:

error: function(jqXHR, textStatus, errorThrown){
    alert('error');
}

to your ajax call?Also bear in mind that to see stuff in the firebug console you must use console.log or console.dir. 还请记住,要查看Firebug控制台中的内容,您必须使用console.log或console.dir。 You could also check the NET log to see if the call succeeded 您还可以检查NET日志以查看呼叫是否成功

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM