4
The following Ajax call would send PHP the parameters corresponding to the form that called the function:
var foo = "bar";
var bar = "foo";
function register(){
$.ajax({
method: "post",
url: "meu_script.php",
data: $("#form").serialize(),
});
}
And would be accessible in PHP through id
s of the HTML form components:
$campo = $_POST['id_campo'];
$senha = $_POST['id_senha'];
My question: what if instead of using a form, I wanted to pass the values of the variables foo
and bar
, how the parameter would look data
of my call Ajax?