我想将html输入转换为ajax请求,将{acct";acountnumberher}作为php脚本的curl选项
这是在wordpress网站上,我正在创建一个多步骤表单。在进入下一步之前,应验证帐号的输入。我创建了一个通用按钮,wehn按下该按钮可以查看帐户是否存在,然后继续下一步 我使用jQuery和PHP,我获取的数据在另一台服务器上,我使用本地化脚本方法从另一台服务器获取数据。在成功返回JSON之前,curl的头需要curl_选项={“accnt:”account#}。我至少可以把帐号输入到php端。这是到目前为止我的代码我想将html输入转换为ajax请求,将{acct";acountnumberher}作为php脚本的curl选项,php,jquery,json,ajax,wordpress,Php,Jquery,Json,Ajax,Wordpress,这是在wordpress网站上,我正在创建一个多步骤表单。在进入下一步之前,应验证帐号的输入。我创建了一个通用按钮,wehn按下该按钮可以查看帐户是否存在,然后继续下一步 我使用jQuery和PHP,我获取的数据在另一台服务器上,我使用本地化脚本方法从另一台服务器获取数据。在成功返回JSON之前,curl的头需要curl_选项={“accnt:”account#}。我至少可以把帐号输入到php端。这是到目前为止我的代码 jQuery('#nextBtn').on('click',
jQuery('#nextBtn').on('click',function(e) {
e.preventDefault();
var account = jQuery('#account_number').val();
//This is to check if the account number exist with AJAX
//if(!account.valid()) return false;
jQuery.ajax({
type:'post',
url: php.script.php,
dataType: "json",
//beforesend:account.serialize(),
data: {acct: +account},
statusCode: {
404: function() {
alert( "Your Account Doesnt Exist" );
},
200: function () {
alert("I have successfully connected an account");
}
},
success:function (response) {
console.log(account);
alert("I am the return account #"+account);
},
error:function(errThrown){
alert("I AM THE ERROR");
}
});
然后,如果我可以得到整个{key:value},那么我希望至少能够更好地将输入输入到php脚本中
php.script.php
$Account = $_POST['From the ajax'];