Hi, I was reading HERE that since WP 2.8 a global variable "ajaxurl" is defined to be used in ajax calls.
The fact is, before starting writing the code I tested the value of it but it says it's not defined. My app already uses JQuery.
add_action('wp_head', 'myheadfunc');
function myheadfunc()
{
?>
<script type="text/javascript" language="javascript">
//<![CDATA[
jQuery(document).ready(function () {
alert( ajaxurl );
});
//]]>
</script>
<?php
}
In the console I get:
ajaxurl is not defined
alert( ajaxurl );
Please help.
edit: Ok reading more carefully the link, it says that on the frontend that variable is not automatically defined.