[wp-hackers] ajax to call function in theme
Otto
otto at ottodestruct.com
Thu Oct 29 20:07:28 UTC 2009
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 at gmail.com> wrote:
> On Thu, Oct 29, 2009 at 3:02 PM, Otto <otto at ottodestruct.com> 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 at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list