开发者

why I am not receiving any firebug console response stuff?

开发者 https://www.devze.com 2023-03-31 23:24 出处:网络
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

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

   $.ajax({
      type: "P开发者_开发问答OST",
      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

$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
  • 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

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. Check this link: 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. You could also check the NET log to see if the call succeeded

0

精彩评论

暂无评论...
验证码 换一张
取 消