My html form:
<input id="captcha_response" name="captcha_response" type="text" value="" size="5" maxlength="5">
<div class="new_comment"><input id="comment" name="comment" type="text" value="your comment here..."></div>
<div class="author"><input name="name" type="text" value="your name"></div>
<div class="email"><input name="email" type="text" value="email"></div>
My jquery:
$.ajax({
type: "GET",
url: "ajax/check_captcha.php",
data: ({ captcha : captcha , comment:comment , name:name, email:开发者_如何转开发email }), dataType: "json", success: function(data)
{
This is returning a 'not enough arguments' error in firebug.
It was working with just the 'captcha' value being passed but no longer.
Email seems to be the value that is not being passed on.
try removing the two (
and )
in data, just like this
data: { captcha : captcha , comment:comment , name:name, email:email },
if your html inputs are on a <form>
tag, it would be easier to use .serialize() and let jquery get all the data,...
like this
data: $('#fomID').serialize(),
// this will build something like
// "captcha=captchaData&comment=newComment&name=name&email=email@email.en"
You said that they are form names? Yet, have you defined them as variables. Couldn't tell since you don't show the rest of your script.
data: {
captcha : $("input[name='captca_response']").val(),
comment : $("input[name='comment']").val(),
name : $("input[name='name']").val(),
email: $("input[name='email']").val()
}
Try something like that, so that you actually return the values of the inputs.
精彩评论