提交表单和ajax文章上的textarea [英] Submit form and a textarea on ajax post
本文介绍了提交表单和ajax文章上的textarea的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的ajax帖子上提交一份表格和另一份textarea,这可能吗?这是我的代码
I want to submit a form and another textarea on my ajax post, will that be possible? Here is my code
<script>
function updateuseracc(form, password)
{
var p = document.createElement("input");
form.appendChild(p);
p.name="p";
p.type="hidden";
p.value=hex_sha512(password.value);
password.value="";
var email=$("#curemail").val();
$.post('updateuser.php',$('#myform').serialize(),textarea:textarea),(function(data){
});
}
</script>
我刚收到错误
推荐答案
第一个textarea不是变量。如果你想获得它的价值:
First textarea is not a variable. If you want to get the value of it do this:
var text = $(textarea).text ();
将数据放在大括号中,函数是第三个参数。
Put data in curly braces, function is third parameter.
$.post('updateuser.php', {
form:$('#myform').serialize(),
textarea:text},
function(data){
//code...
});
此外,您应该注意服务器端的任何安全功能!
In addition, you should take care of ANY security features on the server side!
http://api.jquery.com/jquery.post/
这篇关于提交表单和ajax文章上的textarea的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文