Re: jquery cakephp post data problem
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,stZendesha...@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,stZendesha...@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 Jmileswjohn...@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
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,stZendesha...@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,stZendesha...@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 Jmileswjohn...@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
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, stZen wrote: Not using Auth and the security level is low.. Thanks. On Jul 5, 10:01 pm, Miles Jmileswjohn...@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
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, stZendesha...@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, stZen wrote: Not using Auth and the security level is low.. Thanks. On Jul 5, 10:01 pm, Miles Jmileswjohn...@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
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, stZen wrote: Not using Auth and the security level is low.. Thanks. On Jul 5, 10:01 pm, Miles Jmileswjohn...@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 using jquery 1.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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
Are you getting a response back in the ajax request? And are the correct HTTP post headers being sent? --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
I think you can try with $_POST['id'] --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
I am getting a response back (with an error saying there is no view set, but thats ok). My problem is that I am not able to see the posted data in the controller. On Jul 5, 4:35 am, Miles J mileswjohn...@gmail.com wrote: Are you getting a response back in the ajax request? And are the correct HTTP post headers being sent? --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
I tried that and it was blank. On Jul 5, 6:43 am, Marco marco.perg...@gmail.com wrote: I think you can try with $_POST['id'] --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
What I would suggest is, try to install firebug and use firefox, you could see what data exactly being posted and it would help you more on debugging. Regards, Hendry On Sun, Jul 5, 2009 at 11:14 PM, stZendesha...@gmail.com wrote: I am getting a response back (with an error saying there is no view set, but thats ok). My problem is that I am not able to see the posted data in the controller. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
Hendry, Thanks for responding. I used firebug to find the following: In the console, I see 2 requests first one is aPOST, second is a GET for the POST the request headers are: Host localhost User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) Gecko/ 2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729) Accept */* Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive Content-Type application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With XMLHttpRequest Referer http://localhost/ck4/app/webroot/index.php Content-Length 29 Cookie CAKEPHP=fugu87s6t2ugpn2a9t6dnblpo2 the POST data is: ajax true id usa So clearly the data is getting posted, but I am not able to access it (or not accessing it the right way) I tried $_POST, $this-params['form']['id'], etc to no avail. Any ideas? Thanks. joe On Jul 5, 10:19 am, Hendry hendry@gmail.com wrote: What I would suggest is, try to install firebug and use firefox, you could see what data exactly being posted and it would help you more on debugging. Regards, Hendry On Sun, Jul 5, 2009 at 11:14 PM, stZendesha...@gmail.com wrote: I am getting a response back (with an error saying there is no view set, but thats ok). My problem is that I am not able to see the posted data in the controller. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
Are you using Auth at all? Also try setting your session security to medium or low if its not. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
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. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
On 07/06/2009 12:48 AM, stZen wrote: Not using Auth and the security level is low.. Thanks. On Jul 5, 10:01 pm, Miles Jmileswjohn...@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 using jquery 1.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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
jquery cakephp post data problem
I am trying to get a simple example working integrating jquery with cakephp. here is the view: ?php echo $form-create('Booking',array('class'='ajax_page')); echo $form-input('country_id',array( 'label'='Country')) ; echo $form-end(); ? The javascript: $('#BookingCountryId').blur(function(){ // selected value var selected = $(this).val(); // set loading image //ajax_loading_image('.ajax_loading_image'); // ajax $.ajax({ type: POST, url: 'categories/getIndications', data: ajax=trueid=+selected, success: function(msg){ //console.log(msg); //$('.ajax_location_id').html(msg); // remove loading image // ajax_remove_loading_image ('.ajax_loading_image'); } }); }); and the controller: class CategoriesController extends AppController { var $uses = Indication; var $components = array(RequestHandler); function getIndications() { $this-log(getindicator called.$this-params['form']['id']); return ind1; } } The problem is that the function getIndications get called, but $this- ['form']['id'] doesnt contain the submitted value. What am I doing wrong? Thanks. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
Try changing this: data: ajax=trueid=+selected, To: data: data[ajax]=truedata[id]=+selected, And then you can grab the data with $this-data['ajax']; --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jquery cakephp post data problem
Thanks for responding. I tried that and changed the controller to $this-log(getindicator called.$this-data['ajax']); but didnt change anything. On Jul 4, 3:31 pm, Miles J mileswjohn...@gmail.com wrote: Try changing this: data: ajax=trueid=+selected, To: data: data[ajax]=truedata[id]=+selected, And then you can grab the data with $this-data['ajax']; --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---