title: Wordpress Frontend Ajax with wp_localize_script Error: ajaxurl is not defined
body: <p>I'm trying to create markers on a map via ajax on a wp theme.
  After some struggle I found out that I can't use any php file to get data via ajax, I have to use the admin-ajax.php file.</p>
  
  <p>Accordingly to many examples, this is my code</p>
  
  <p>in functions.php</p>
  
  <pre><code>add_action( 'wp_enqueue_scripts', 'add_frontend_ajax_javascript_file' );
  function add_frontend_ajax_javascript_file()
  {
     wp_localize_script( 'frontend_ajax', 'frontendajax', array( 'ajaxurl' =&gt; admin_url( 'admin-ajax.php' )));
      wp_enqueue_script( 'ajax_custom_script',  get_stylesheet_directory_uri() . '/includes/ajax-javascript.js', array('jquery') );
  
  }
  
  add_action( 'wp_ajax_get_post_information', 'get_post_information' );
  add_action( 'wp_ajax_nopriv_get_post_information', 'get_post_information' );
  
  
  function get_post_information() 
  { 
  
  $get_this= $_GET['this'];
  $get_that= $_GET['that'];
  
  ...my select...
  
  echo json formatted data
  }
  </code></pre>
  
  <p>The js file is loaded and working, it does other stuff before the ajax call, where it stops for an error in this line: </p>
  
  <pre><code>$.post({ 
          url:frontendajax.ajaxurl,
          {
              action: 'get_post_information',
              data: data
          },
          success: function(response) {
  </code></pre>
  
  <p>But I always Have the same error:</p>
  
  <p><strong>Reference Error: frontendajax.ajaxurl is not defined</strong></p>
  
  <p>where is my error?</p>
  
  <p>PS: I use get_stylesheet_directory_uri() because I am in a child theme.</p>