$.post to send the stuff to the server, with a "json" paramater at the
end.
Thanks for the link James
On May 29, 5:26 am, Euan Goddard <euan.godd...@2degreesnetwork.com>
wrote:
> Yeah jQuery added this annoying "feature" in 1.4.
>
> There's no "nice" way around it other than to recognise that any JS
> arrays will have this suffix.
>
> Euan
>
> On 29 May, 05:33, pyfreak <sitecontac...@gmail.com> wrote:
>
>
>
> > I accept this as normal now. I think, what I'll need to do if I'm
> > against stripping off the two characters, is simply putting the value
> > that serves as the key, directly into the array as the last element.
> > Simple enough.
>
> > So in views function:
> > It'll look like: request.POST["imthekeyval[]"] = ("someval",
> > "anotherval", "imthekeyval")
>
> > code:
>
> > for key in request.POST.getlist(key):
> > py_array = request.POST.getlist(key)
>
> > ( py_array has all I need, no need to use the key which is
> > sporting the mutant "[]" growth at the end )
>
> > On May 28, 5:41 pm, pyfreak <sitecontac...@gmail.com> wrote:
>
> > > I'm having to, in Javascript, create a dictionary ( my_dict = {} ),
> > > then put in some Arrays.
>
> > > my_dict["stringkey"] = Array("hey","hey1")
> > > my_dict["stringkey1"] = Array("more","stuff")
>
> > > In the views function:
>
> > > for key in request.POST:
> > > prop_rec = request.POST.getlist(key)
>
> > > The Python var, "prop_rec" has the array contents that I'm
> > > expecting.
>
> > > However, I also need to use "key". But when I'm sending over stuff
> > > from javascript like above,
> > > the key has a "[]" tacked on the end of it, like "stringkey[]"
>
> > > If I code the normal in js:
> > > my_dict["stringkey"] = "1",
> > > then if I do a print key in the views function, I don't get
> > > the brackets at the end
>
> > > So just wondering if that's normal.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment