On view : var input_id = '2'; $.getJSON("http://website/controller/action",{id:input_id},function(data){ // callback if(data.result){
} }); On Controller : $this->params['url']['id']; On Wed, 2009-04-22 at 12:36 -0700, rartavia wrote: > Hello, I'm wondering how to make jQuery.ajax call to cake when you > need to send parameters both simple values or complex (json, objects, > etc). > I've two scenarios, one is not to send a form but a really complex js > object, how do I send it with jQuery.ajax? > The second is, also not sending a form but a single/simple value or > set of simple values. > For this second I've made some tests: > > jQuery.ajax({ > type: "POST", > url: '/controller/action', > data: {value:"1,2,3,4,5"}, > }); > > var test = []; > test["data['value']"] = "myvalue" > jQuery.ajax({ > type: "POST", > url: '/controller/action', > data: test, > }); > > Tryied to read on server side with both $this->params["value"] and > $this->data["value"] without succes. > How do one sends nonforms, complex and simple values and how to read > them in controllers (server side)? > > 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 -~----------~----~----~----~------~----~------~--~---