I've got a question.

How do i use Ajax on my small templates...

in single.php I've :

  $.ajax({
    type: "POST",
    url: "http://www._____wp-content/themes/MS-MangoBerry___/myajax.php",
    data: "yo",
    cache: false,
    success: function(data)
    {
      alert("yes");
    }
  });

As well as in myajax.php, I've

$(document).ready(function() )

I Quickly come with an error : Fatal error: Call to undefined function get_header() in myajax.php

How Come ?

Thanks ahead of time.

wordpress includes a built ajax url you need to use. this publish can help you out. http://geekpreneur.blogspot.com/2009/06/how-to-use-wpajax-in-wordpress.html

the tricky factor is when wordpress knows which function need your call back. it takes place with the addition of an action. the hook from the action is the ajax action prepended with wordpress_ajax_

Please also take a look only at that article http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/#js-global

It indicates that AJAX demands ought to be posted to /wordpress-admin/admin-ajax.php

And also the you can hook the request applying this code in functions.php


add_action('wp_ajax_your_ajax_action_name', 'method_name')

add_action('wp_ajax_nopriv_your_ajax_action_name', 'method_name')

Then you may implement a technique in functions.php


function method_title()



Around the request you should also send a parameter title 'action' with worth of the experience title.

within this situation it might be action=your_ajax_action_title.

Hope this help :)