title: how to get wordpress home url in javascript?
body: <p>in php get_home_url()
  I using ajax.</p>
  
  <pre><code>&lt;script&gt;
  $j=jQuery.noConflict();
      $j(document).ready(function(){
          $j('.new_post_btn').click(function(){
              var dataString = {
              'action': 'new_post_action',
              'post_status': 'draft',
          };
  
              dataString=
                  jQuery.ajax({
                      type: "POST",
      url: "http://localhost/wordpress/wp-admin/admin-ajax.php",
                    data: dataString,
                                      success: function(msg){
                           if(msg!='false')
                                                   {
                                                       msg=msg.substring(0, msg.length-1);
                                                       window.location='http://localhost/wordpress/wp-admin/post.php?post='+msg+'&amp;action=elementor';
                                                   }
                         }
  
                   });
          });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>I want to use '<a href="http://localhost/wordpress" rel="nofollow noreferrer">http://localhost/wordpress</a>'  to javascript function to get wordpress home url.</p>