Php 如何使用jQueryAjax发布两个变量
如何使用jQueryAjax发布两个变量?一个变量工作正常,但两个变量不工作Php 如何使用jQueryAjax发布两个变量,php,jquery,ajax,Php,Jquery,Ajax,如何使用jQueryAjax发布两个变量?一个变量工作正常,但两个变量不工作 function get() { $('#age').hide(); $.post('jrecomment2.php',{ userID: form.userID.value },{ id_number: form.id_number.value } function(output){ $('#age').html(output).slideDown(2000);
function get() {
$('#age').hide();
$.post('jrecomment2.php',{ userID: form.userID.value },{ id_number: form.id_number.value }
function(output){
$('#age').html(output).slideDown(2000);
});
}
及表格:
<form name="form" dir="rtl">
<input type="text" name="userID">
<input type="text" name="id_number">
<input type="button" value="submit" style=" width: 120;" onClick="get();">
</form>
您需要使用
{userID:form.userID.value,id\u number:form.id\u number.value}
您可以使用此代码
$.post('jrecomment2.php',{ userID: form.userID.value, id_number: form.id_number.value }, function(output){ });
$.ajax({
type: "POST",
url: 'jrecomment2.php',
data: 'userID=' + form.userID.value+'&id_number='+form.id_number.value,
dataType: 'text',
async: false,
cache: false,
success: function (output) {
$('#age').html(output).slideDown(2000);
}
});
和post方法
$.post('jrecomment2.php',{ userID: form.userID.value, id_number: form.id_number.value }, function(output)
{
$('#age').html(output).slideDown(2000);
}
);
非常感谢你