0

Im using this tutorial http://digwp.com/2009/07/display-a-random-post-with-ajax-refresh/# to create a section on my homepage where I can refresh a section with ajax. I have it all setup but the post is not loading on page load. I found a line in the page source that says...

<script type="text/javascript">var ajaxurl = "http://mysite.com/wp-load.php";   </script>

The </script> isn't highlighted like the beginning <script> so I'm wondering if that's the problem. Any idea why that is?

  • 2
    You should be localizing that and using admin-ajax.php anyways. Read this article for correct implementation. – mor7ifer Feb 7 '12 at 2:04
  • Hmmm ok that tutorial went over my head. What changes should I apply to the tutorial above to make it work properly? – Pollux Khafra Feb 7 '12 at 2:35
  • @m0r7if3r you should post that as an answer. – Chip Bennett Feb 16 '12 at 3:48
  • I felt like it was a bit skimpy to be considered an answer...but done. – mor7ifer Feb 16 '12 at 10:32
1

You should be localizing that and using admin-ajax.php anyways. Read this article for correct implementation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.