wordpress ajaxurl is not defined’ fix

if ‘ajaxurl is not defined’ error
fix functions.php write

add_action(‘wp_head’,’ajaxurl_’);
function ajaxurl_() {
   ?>
<script type=“text/javascript”>
var ajaxurl = ’<?php echo admin_url(‘admin-ajax.php’); ?>’;
</script>
<?php
}