WORDPRESS:Ajax和模板

I have a question.

How can I use Ajax on my templates...

in single.php I have :

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

And in myajax.php, I have

$(document).ready(function() { alert("ok"); });

Then I have an error : Fatal error: Call to undefined function get_header() in myajax.php

Why ?

Thanks in advance.

查看全部
weixin_33698823
weixin_33698823
2011/03/19 01:09
  • post
  • wordpress
  • ajax
  • 点赞
  • 收藏
  • 回答
    私信

2个回复