Not sure I follow.
I have everything as POST, but the 1 form changes automatically to PUT for some reason. This is what I am trying to figure out. The JS / AJAX is POST but in the controller as I stated if $this->request->is('post') and somewhere along the way it changes to PUT then that form will never get submitted.
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of André Luis
Sent: Tuesday, May 07, 2013 9:42 AM
To: cake-php@googlegroups.com
Subject: Re: POST form changes to PUT
If you´re sending the data via AJAX, what is the difference between the hidden fields method be PUT or POST? the data will be sent via AJAX as POST anyway...
Em segunda-feira, 6 de maio de 2013 15h47min55s UTC-3, advantage+ escreveu:
Running into a weird issue where my form as rendered the HTML shows:
<form id="EditProfile" class="form-horizontal" accept-charset="utf-8" method="post" action="/manage/profile">
This form is submitted using ajax and the function is used by many forms thru the site:
$.ajax({
type: "POST",
url: $(sel).attr('action'),
data: $(sel).formSerialize(),
dataType: 'json',
And in the controller I have if($this->request->is('ajax') && ($this->request->is('post'))
But it fails on this 1 form because for some reason it is changing to PUT.
Are there reason why this would be happening? I looked at a few of my forms using this js function and all of the forms and all are set up the exact same way / Form->helper standard inputs / selects.
I even added into the form with issues 'method' => 'POST' (upper and lower) but it still fires off a PUT request. Renders as POST but inspecting the request shows:
application/x-www-form-urlencoded
_methodPUT
Ideas would be welcome.
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment