can i send all that into json afterwards to send it to the server ?
Thanks Alex ----- Original Message ----- From: "Mona Remlawi" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Monday, November 17, 2008 12:52 PM Subject: [Proto-Scripty] Re: Sending Json to the server > > ok what about this: > > var params = {}; > $$('.formJson').each(function(e) { > params[$(e).dbCol] = $(e).value; > } > > cheers > > -- > mona > [EMAIL PROTECTED] > > On Mon, Nov 17, 2008 at 1:43 PM, Alex Mcauley > <[EMAIL PROTECTED]> wrote: >> >> cant use it as it needs to be custom as stipulated ... i need to get >> certain >> fields from the input elements .. >> >> merge() seems to want to do it but is not working as expected >> >> Thanks >> Alex >> >> ----- Original Message ----- >> From: "Mona Remlawi" <[EMAIL PROTECTED]> >> To: <[email protected]> >> Sent: Monday, November 17, 2008 12:34 PM >> Subject: [Proto-Scripty] Re: Sending Json to the server >> >> >>> >>> hmm just out of the top of my head here, did you try using >>> $H(form.serialiaze()) ? >>> >>> cheers >>> >>> -- >>> mona >>> [EMAIL PROTECTED] >>> >>> On Mon, Nov 17, 2008 at 1:13 PM, Alex Mcauley >>> <[EMAIL PROTECTED]> wrote: >>>> >>>> basically i think i need a push method to push values into a json >>>> object >>>> >>>> then i can try to decode it on the server!! >>>> >>>> ----- Original Message ----- >>>> From: "Jeztah" <[EMAIL PROTECTED]> >>>> To: "Prototype & script.aculo.us" >>>> <[email protected]> >>>> Sent: Monday, November 17, 2008 11:51 AM >>>> Subject: [Proto-Scripty] Sending Json to the server >>>> >>>> >>>>> >>>>> Morning Guys ... >>>>> >>>>> I am having a real headache trying to send json data to the server and >>>>> have php decode it so i can do something with the data .. >>>>> . >>>>> Basically what i am trying to do is... >>>>> >>>>> I have a form and i would like to send data to the server in Json form >>>>> (key/value pairs) so i can go over it in a loop with php cehcking >>>>> somehting against a database... >>>>> >>>>> I did think of serialize() but i need to send information in a custom >>>>> tag thats in some input values somethin like >>>>> >>>>> <input type="text" id="foo_12323142341234" class="formJson" >>>>> dbCol="forename" value="John" /> >>>>> <input type="text" id="foo_12323142344321" class="formJson" >>>>> dbCol="surname" value="Doe" /> >>>>> and have in the json >>>>> var params=new Array(); >>>>> $$('.formJson').each(function(e) { >>>>> var p=$(e).dbCol + $(e).value; >>>>> var d=p.toJSON(); >>>>> params.push(d); >>>>> } >>>>> to end up with something like ..... >>>>> "forename" : "John", >>>>> "surname" : "Doe" >>>>> >>>>> toJSON() seems to not be playing nice and tells me its not a function >>>>> >>>>> Can anyone think of a way to encode all the elements with the >>>>> className of 'formJson' grabbing the custom tag (dbCol) and the value >>>>> of the element into an object or an array and send it to the server >>>>> (running php 5.2) so i can process it on the server end .. >>>>> >>>>> I've been scratching my head over it all morning and cant find a >>>>> solution !! >>>>> >>>>> Regards >>>>> Alex >>>>> > >>>>> >>>> >>>> >>>> > >>>> >>> >>> > >>> >> >> >> > >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
