dozc1071
dozc1071
2014-02-09 18:06

使用ajax发送表单数据

  • php
  • ajax
  • javascript
  • jquery

I want to send all input in a form with ajax .I have a form like this.

<form action="target.php" method="post" >
    <input type="text" name="lname" />
    <input type="text" name="fname" />
    <input type="buttom" name ="send" onclick="return f(this.form ,this.form.fname ,this.form.lname) " >
</form>

And in .js file we have following code :

function f (form ,fname ,lname ){
    att=form.attr("action") ;
    $.post(att ,{fname : fname , lname :lname}).done(function(data){
        alert(data);
    });
    return true;

But this is not working.i don't want to use Form data .

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

7条回答

为你推荐

换一换