First of all, you can’t send arrays directly through GET requests (GET requests are the ones with the parameters visible in the url, in layman terms)
therefore, you should do the following:
$date = "$year-$month"; //example: 2013-09
$link = admin_url('admin-ajax.php?my_date=".$date."&post_id='.$post->ID.'&nonce=".$nonce);
breaking the url down to the components, in layman terms:
- everything before the
?
is the server address and the page that needs to be served - everything after is the so-called “querystring”, which is a sequence of pairs (
A=B
) separated by ampersands&
.
so, a URL that looks like this
www.example.com/dynamic_page.php?A=B&C=D&E=F
means:
visit www.example.com, fetch the page named “dynamic_page.php” and use the value B for the variable A, the value D for the variable C and the value F for the variable E.
1
solved Pass PHP variable to server