jQuery conditionals & Ajax problems

I'm writing a form that will change all of the user's profile settings. I have the HTML and PHP set up correctly and working, but using jQuery conditionals & Ajax is proving to be a problem. It should validate for an email if one is there. Then, it should make sure the change isn't a password change (if it is, make sure passwords match then post), then post if the form was valid. It seems to not consider any of the conditionals and post regardless. $("profSet").validate({ rules: { chem: { email: true } } }); $('#subSet').live('click',function() { if($("#chfn").val() == 0 && $("#chln").val() == 0 && $("#chpw").val() == 0 && $("#chpw2").val() == 0 && $("#chem").val() == 0) { if($("#profSet").valid()) { if($("#chpw").val() == "" && $("#chpw2").val() == "") { $.post('php/profSet.php', $('#profSet').serialize(), function(){ $('#profSet').hide(); $('#success').show(); }); } else { if($("#chpw").val() == $("#chpw2").val()) { $.post('php/profSet.php', $('#profSet').serialize(), function(){ $('#profSet').hide(); $('#success').show(); }); } else { $('#error').show(); } } } } }); Any help?

以上就是jQuery conditionals & Ajax problems的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏