Wednesday, July 29, 2009

Re: jquery cakephp post data problem

Figured out problem. It was related to mod rewrite as I suspected.
In the .htaccess files in /cake and /cake/app directories, the rewrite
rule was so: (only the relevant part is shown)

RewriteRule ^$ app/webroot/ [R]
RewriteRule (.*) app/webroot/$1 [R]

Once the flag was changed to [L], POST started working.

Thanks to all those who responded.

On Jul 29, 6:04 pm, stZen <desha...@gmail.com> wrote:
> brian,
> Thanks for responding.
> I tried that, $this->params['form']['id'] still returns nothing. (with
> undefined index 'id' php error)
>
> In firebug I see a POST and then  a GET
>
> joe
>
> On Jul 29, 12:03 am, brian <bally.z...@gmail.com> wrote:
>
>
>
> > try it like this:
>
> > data: { ajax: true, id: selected }
>
> > You should see it in $this->params['form']['id']
>
> > On Tue, Jul 28, 2009 at 11:08 PM,stZen<desha...@gmail.com> wrote:
>
> > > Though I was able to solve my immediate problem with GET, I would like
> > > to know how to do this using POST. Anyone has any idea?
>
> > > On Jul 6, 5:33 pm,stZen<desha...@gmail.com> wrote:
> > >> Martin,
>
> > >> Thanks for responding.
>
> > >> That worked! (using GET) I have been reading up some and looks like
> > >> its related
> > >> to mod_rewrite. If you have any ideas on getting POST working, please
> > >> let me know.
>
> > >> On Jul 6, 12:39 am, Martin Radosta <martinrado...@gmail.com> wrote:
>
> > >> > On 07/06/2009 12:48 AM,stZenwrote:
>
> > >> > > Not using Auth and the security level is low..
>
> > >> > > Thanks.
>
> > >> > > On Jul 5, 10:01 pm, Miles J<mileswjohn...@gmail.com>  wrote:
>
> > >> > >> Are you using Auth at all?
> > >> > >> Also try setting your session security to medium or low if its not.
>
> > >> > Try this and give us some feedback. If this works, we can try doing a post:
>
> > >> > in the view
>
> > >> >          $.ajax({
> > >> >                  type: "GET",
> > >> >                  url: 'categories/getIndications/' + selected,
> > >> > ...
>
> > >> > In the controller
>
> > >> > function getIndications($id) {
>
> > >> >      $this->log("getindicator called".$id);
> > >> > ....
> > >> > ...
>
> > >> > Are you usingjquery1.3.2 ??
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: