Nope. This is where I get stuck.
var sub_data = { data: { Setting: { "field": sub_val } } };
I always get data[Setting][field] = the correct value
field and sub_val are variables so sub_val prints out value 1,2,3 or what
not but field always gets printed as field, even though field is not field
(field might be "restricted", "allow", "foreign" so I should end up with
data[Setting][restricted] or one of the fields.
So that’s where I am stuck.
Thanks again,
Dave
-----Original Message-----
From: Miles J [mailto:[email protected]]
Sent: November-03-10 11:34 PM
To: CakePHP
Subject: Re: Help with array
Wouldnt this work? Havent tried.
var data = { Model: { username: 'miles'; } }
On Nov 3, 6:57 pm, "Dave Maharaj" <[email protected]> wrote:
> I think so!
>
> It has a model. Im using a jquery plugin and where the user slides
something
> I have a #id which corresponds to a field and a value so I want to save it
> but it has no built in way to save that data so that's what im trying to
do!
>
> So I want to mimic what that looks like. I only asked a question! If you
> want to be a comic maybe you should give that a try. It is a help forum is
> it not? If we were all as skilled as you then who would you insult?
>
> From: Matt Murphy [mailto:[email protected]]
> Sent: November-03-10 11:21 PM
> To: [email protected]
> Subject: Re: Help with array
>
> Am I being moronic, everyone?
>
> Matt
>
> On Wed, Nov 3, 2010 at 9:50 PM, Matt Murphy <[email protected]> wrote:
>
> It's your data. Make a model for it.
>
> On Wed, Nov 3, 2010 at 8:18 PM, Dave Maharaj <[email protected]> wrote:
>
> Does anyone know how to manually create an array in js that would mimic
the
> data sent normally?
>
> I simply need to send off 1 key => value pair so it looks like
> data['model']['field'] => 0 since that is what the controller is expecting
>
> Not using a form as what is being done is not possible..
>
> The js has field value passed to it.just cant seem to get the array right.
>
> SCRIPT (NOT CONTROLLER)
>
> function update ( field , value ) {
>
> var user_data= new Array()
>
> ????
>
> $.ajax({
>
> type: "POST",
>
> cache:false,
>
> url: '/user/update',
>
> data: user_data
>
> });
> }
>
> Thanks,
>
> Dave
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> <mailto:cake-php%[email protected]> For more options, visit
> this group athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
athttp://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en