How can I pass multiple variables between PHP files using jquery with json? Ex:
$.post("example.php", {asdf:asdf, sdfg:sdfg}, function(data){
$('section').html(data);
});
But instead of just using the .html
function I want to retrieve multiple variables from the PHP file and then use them for .html
on my page. I can't just use data
because that only outputs whatever PHP returns so to my understanding php can only return one thing in a form of an echo()
, but how can I make it retrieve more than just that one variable? I think I have to use JSON but I have never used JSON before so I would appreciate it if someone could help me out.
Thanks.