我需要发布到此网址
https://liceoeuroamericano.territorio.la/webservices/persona.php
我需要发布2个不同的参数
PARAM
method=activateUser
param
{
"auth_key": "123456",
"user": "[email]",
"active":"[0/1]"
}
string(JSON)
<button id="activateUser">GO</button>
<script>
$('#activateUser').on('click', function(){
$.post('https://liceoeuroamericano.territorio.la/webservices/persona.php',
{
method=activateUser¶ms={
"auth_key": "123456",
"user": "[email]",
"active":"[0/1]"
}
string(JSON)
}, function(data){
})
});
</script>
答案 0 :(得分:0)
如果我理解了您的要求,您需要将method
作为字符串传递,然后JSON对params
对象进行编码。如果是这样,这应该对你有用:
$.post('https://liceoeuroamericano.territorio.la/webservices/persona.php', {
method: 'activateUser',
params: JSON.stringify({
auth_key: "123456",
user: "[email]",
active: "[0/1]"
})
}, function(data){
console.log('request completed successfully');
})