简体   繁体   English

为什么我的jquery验证程序没有显示任何警报消息?

[英]Why my jquery validator doesn't show up any alert msg?

I created a form with jquery validator attached to it. 我创建了一个表单,其中附加了jquery验证程序。 You can see it here http://jsfiddle.net/5WMff/1327/ 您可以在这里看到它http://jsfiddle.net/5WMff/1327/

however, when I fill all the data and hit send button - my page reloads and nothing from the php script (that contains for now only echo "hey!!" message) gets displayed on screen. 但是,当我填充所有数据并单击“发送”按钮时-我的页面重新加载,并且php脚本(目前仅包含echo "hey!!"消息)没有任何内容显示在屏幕上。 I believe there might be some problem in my syntax, but I don't see anything wrong in developer console in chrome.. Can you verify my fiddle and check whether those parts are correct: 我相信我的语法可能存在问题,但是在chrome开发者控制台中我看不到任何错误。您可以验证我的小提琴并检查这些部分是否正确:

p.name = "p";
p.type = "hidden";
p.value = hex_sha512($("#password").val());

// Make sure the plaintext password doesn't get sent. 
$("#password").val() = "";

and later on: 后来:

$.ajax({
  url: 'includes/register.inc.php',
  type: "POST",
  data: {
    username: username,
    email: email,
    p : p,
    company: company,
    contact: contact,
    phone: phone,
    address1: address1,
    address2: address2,
    city: city,
    zipcode: zipcode,
    state: state,
    country: country

  },
  dataType: 'text',
  success: function(response) {
    alert('success');   
  },
  error: function(response){
    alert('ERROR');
  }
});

I guess instead of p the html element you would have to send the value of it: 我想不是p的html元素,您必须发送它的值:

p : p.value,

and you have to reset the password element like: 并且您必须重置密码元素,例如:

$("#password").val('');

Try to stringify your data 尝试对数据进行分类

JSON.stringify( data: {
username: username,
email: email,
p : p,
company: company,
contact: contact,
phone: phone,
address1: address1,
address2: address2,
city: city,
zipcode: zipcode,
state: state,
country: country});

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

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