« Return to Thread: ajax to call function in theme

Re: ajax to call function in theme

by Otto-19 :: Rate this Message:

| View in Thread

That should probably be clarified then. If you're going to send AJAX
requests to separate files, then those separate files have absolutely
no visibility to any part of WordPress at all.

The normal case should be the action method, because you probably want
to access WordPress or the database, in some manner.


-Otto
Sent from Memphis, TN, United States


On Thu, Oct 29, 2009 at 3:05 PM, Austin Matzko <if.website@...> wrote:

> On Thu, Oct 29, 2009 at 3:02 PM, Otto <otto@...> wrote:
>> Let me guess: You put this server side code into some separate PHP
>> file somewhere, and now are calling that PHP file directly from your
>> AJAX call, yes?
>>
>> I suggest you re-read that tutorial, because that's exactly what you
>> *don't* do, and the tutorial explains why.
>
> Unfortunately, the tutorial *does* suggest that very thing for the
> modified example:
>
>> We need to send our request to a plugin PHP file. This could be the main plugin PHP file, or a separate PHP file. It's probably a little cleaner to do it in a separate file, which we'll assume is called "myplugin_ajax.php", located in the standard wp-content/plugins directory of Wordpress.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

 « Return to Thread: ajax to call function in theme