I'm trying to track page referrals, so I might have a URL like:
www.example.com/?ref=google
I've successfully captured that referral as a variable like so:
if ($_GET['ref'] !== "") {
$ref = $_GET['ref'];
}
else {
$ref = "";
}
How can I pass it through my jQuery POST function?
$.post("signup.php", {email: email, ref: /* what goes here */}, function(data){
$("#validation-message").text(data).addClass("error-text");
});
I've read about json_encode() but is that just for arrays?
$_GET. Why would you need JS to send it to PHP too?$_GET['ref']in a session.