the other way is bullet proof lol.... If it finds a backslash quote it replaces it - if not it doesnt!!.
I agree that someone could send the string with a backslash quote in it but its very unlikely!... More than one way to skin a cat as they say ;) Alex Mcauley http://www.thevacancymarket.com ----- Original Message ----- From: "Eric" <lefauv...@gmail.com> To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com> Sent: Tuesday, October 27, 2009 5:08 PM Subject: [Proto-Scripty] Re: A question about submitting multiple parameters using Ajax.Updater > $posted=str_replace("\\"","\"",$__POST['varaible_2']; It is a little off-topic here, but the back-slashes are added or not depending of PHP's configuration. Here is the bullet-proof way to manage parameters in PHP: $posted = $__POST['varaible_2']; if (get_magic_quotes_gpc()) { $posted = stripslashes($posted); } HTH, Eric On Oct 17, 8:12 pm, "Alex McAuley" <webmas...@thecarmarketplace.com> wrote: > it sends a json object to the server which you remove the slashes and > decode - > > example in php > > $posted=str_replace("\\"","\"",$__POST['varaible_2']; > > $json=json_decode($posted); > > // $json is now a multi dimensional array you can access > > Alex Mcauleyhttp://www.thevacancymarket.com > > ----- Original Message ----- > From: "C K Kashyap" <ckkash...@gmail.com> > To: <prototype-scriptaculous@googlegroups.com> > Sent: Saturday, October 17, 2009 6:17 PM > Subject: [Proto-Scripty] Re: A question about submitting multiple > parameters > using Ajax.Updater > > >> for example... > >> var data={}; > > >> for(i=0; i<=10;++i) { > >> data[i]=i; > >> } > >> var params=Object.toJSON(data); > > >> var request=new Ajax.Request(....... > > >> parameters : { > >> variable_1 : 'Hi i am variable one', > >> variable_2 : params // The json object > >> } > >> ........... > > > This did not quite work ... it looks like Object.toJSON returns a > > string and on the server side what I get is > > > "variable_2" => "{\"data ... > > > Regards, > > Kashyap > > --~--~---------~--~----~------------~-------~--~----~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---