dozc1071
2014-02-09 18:06使用ajax发送表单数据
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条回答
为你推荐
- 使用ajax发送表单数据
- javascript
- ajax
- php
- jquery
- 7个回答
- 表单内部while循环只通过ajax发送第一行数据
- html
- javascript
- ajax
- php
- 1个回答
- 使用ajax发送html数据和表单并保留在当前页面上
- html
- javascript
- ajax
- jquery
- php
- 1个回答
- 如果发送的数据包含多于表单,如何在php中检索表单字段
- ajax
- forms
- php
- 1个回答
- 使用Ajax发送表单数据时PHP不会获得$ _FILES
- ajax
- upload
- php
- jquery
- multipartform-data
- 1个回答
换一换