我的代码如下  在网上找了很多方法都不行  高人请指点
<!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!!");}  
};
alert($("#photo_path").val());
$("#myForm").submit(function(){
$(this).ajaxSubmit(options);
alert("kkk");
return false;
});

});



    </script>
</head>
<body>
   <form id="myForm" action="http://api.soningbo.com/resource/user/register" method="post" enctype="multipart/form-data">  
   
  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>

解决方案 »

  1.   

    ajaxSubmit() 方法呢,没有看到哦
      

  2.   

    <script type="text/javascript" src="jquery.form.js"></script>
    <script type="text/javascript" src="jquery1.7.js"></script>其中是否存在路径错误呢,这边直接输入以下路径没问题
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script> 
    <script src="http://malsup.github.com/jquery.form.js"></script> 
      

  3.   

    原来是我的jquery.form的版本太低了  更新后就好了!