每次提交的时候,总是没反应,在success后面添加一个error:function(){alert("error!");}时,也不执行error里的内容
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <title>My Jquery</title>
   <script type="text/javascript" src="jquery.form.js"></script>
   <script type="text/javascript" src="jquery1.7.js"></script>
   <script type="text/javascript"> 
  
$(document).ready(function(){
var options = {
type:"post",
url:"http://api.soningbo.com/resource/user/register",
data:"key=" + $("#key").val()+"&username="+$("#username").val()+"&password="+$("#password").val()+"&email="+$("#email").val()+"&photo_path="+$("#photo_path").val(),
dataType:"json",
success: function(){alert("ok");},
                                        error:function(){alert("error!");}
};
$("#myForm").submit(function(){
$("#myForm").ajaxSubmit(options);
return false;
});

});
</script>
</head>
<body>
   <form id="myForm" action="这个页面的本身" method="post">
   
  key<br>
  <input type="text" name="key" id="key">
  <br>
  <br>
  
  username<br>
  <label for="username"></label>
  <input type="text" name="username" id="username">
  <br>
  <br>
  
  password<br>
  <label for="password"></label>
  <input type="password" name="password" id="password" >
  <br>
  <br>

 
  email<br>
  <label for="email"></label>
  <input type="text" name="email" id="email">
  <br>
  <br>
  
  photo_path<br>
  <label for="head_photo"></label>
  <input type="file" name="photo_path" id="photo_path">
  <br>
  <br>
   
    <input type="submit" value="Submit Comment" id="ok" name="ok"/>
   </form>
</body>
</html>