[wp-hackers] admin-ajax.php and $_GET?

Otto otto at ottodestruct.com
Wed Oct 22 13:54:33 GMT 2008


GET and POST serve two entirely different purposes, and POST is the
correct one in this case.

GET is for situations where you are getting some data back from the server.
POST is for situations where you are sending something to the server.

The main difference is that browsers can cache the results of a GET
request, and if you do the same GET twice, then the second time you'll
get cached data, it won't hit the server.



On Tue, Oct 21, 2008 at 11:25 PM, Casey Bisson <casey.bisson at gmail.com> wrote:
>
> Was it a conscious decision to limit the action hook in admin-ajax.php to
> $_POST vars only?
>
>        do_action( 'wp_ajax_' . $_POST['action'] );
>
> Or could we just as easily do something like this:
>
>        do_action( 'wp_ajax_' . ( $_POST['action'] ? $_POST['action'] :
> $_GET['action'] ));
>
> We probably can't/shouldn't use $_REQUEST in this context, as cookies have
> precedence, but the above would make something I'm working on now a lot
> easier.
>
> I'd probably just work around it, but seeing that the "ajax-tag-search"
> action uses a GET suggests there can't be too many arguments against GET.
>
> --Casey
> http://about.Scriblio.net/
> http://MaisonBisson.com/
>
> _______________________________________________
> 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