I have read many similar posts, but none of that can help me... :( The question is very simple... How can I pass a PHP array as parameter hash to new Ajax.Updater method? thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
If you''re using PHP5, then there is a json_encode() function which converts a PHP Array to a JSON string. This can then be put into the parameters property of the Ajax.Updater. If you''re not on PHP5, then post back; I''ve a PHP4 class that was modified from the PEAR service to stand along and let you do the same thing. I can send it to you. - Dash - Fabrizio Moscon wrote:> I have read many similar posts, but none of that can help me... :( > The question is very simple... > How can I pass a PHP array as parameter hash to new Ajax.Updater > method? > > thanks > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Yes, I use PHP5 and I can use either Zend_Framework Json functions... so the syntax will be like this: var myAjax = new Ajax.Updater( target, url, {method: ''post'', parameters: { ''id_sender'' : ''<?=$s[''id'']?>'' , ''dests'' : (<? =json_encode($dests)?>) } } ); is it right? On 26 Mag, 17:28, David Dashifen Kees <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If you''re using PHP5, then there is a json_encode() function which > converts a PHP Array to a JSON string. This can then be put into the > parameters property of the Ajax.Updater. If you''re not on PHP5, then > post back; I''ve a PHP4 class that was modified from the PEAR service to > stand along and let you do the same thing. I can send it to you. > > - Dash - > > Fabrizio Moscon wrote: > > I have read many similar posts, but none of that can help me... :( > > The question is very simple... > > How can I pass a PHP array as parameter hash to new Ajax.Updater > > method? > > > thanks--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Looks like it''s a good thing to try. Give it a shot and let me know. As long as that javascript is in a .php file it should work out, or at least give you more to work with. - Dash - Fabrizio Moscon wrote:> Yes, I use PHP5 and I can use either Zend_Framework Json functions... > so the syntax will be like this: > > var myAjax = new Ajax.Updater( target, url, {method: ''post'', > parameters: { ''id_sender'' : ''<?=$s[''id'']?>'' , ''dests'' : (<? > =json_encode($dests)?>) } } ); > > is it right? > > On 26 Mag, 17:28, David Dashifen Kees <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> If you''re using PHP5, then there is a json_encode() function which >> converts a PHP Array to a JSON string. This can then be put into the >> parameters property of the Ajax.Updater. If you''re not on PHP5, then >> post back; I''ve a PHP4 class that was modified from the PEAR service to >> stand along and let you do the same thing. I can send it to you. >> >> - Dash - >> >> Fabrizio Moscon wrote: >> >>> I have read many similar posts, but none of that can help me... :( >>> The question is very simple... >>> How can I pass a PHP array as parameter hash to new Ajax.Updater >>> method? >>> >>> thanks >>> > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I haven''t the json module on the server, but using Zend_Json::encode() function it does''t work. ''dests'':(<?=Zend_Json::encode($d)?>) It looks like a parsing error On 26 Mag, 17:54, David Dashifen Kees <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Looks like it''s a good thing to try. Give it a shot and let me know. > As long as that javascript is in a .php file it should work out, or at > least give you more to work with. > > - Dash - > > Fabrizio Moscon wrote: > > Yes, I use PHP5 and I can use either Zend_Framework Json functions... > > so the syntax will be like this: > > > var myAjax = new Ajax.Updater( target, url, {method: ''post'', > > parameters: { ''id_sender'' : ''<?=$s[''id'']?>'' , ''dests'' : (<? > > =json_encode($dests)?>) } } ); > > > is it right? > > > On 26 Mag, 17:28, David Dashifen Kees <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> If you''re using PHP5, then there is a json_encode() function which > >> converts a PHP Array to a JSON string. This can then be put into the > >> parameters property of the Ajax.Updater. If you''re not on PHP5, then > >> post back; I''ve a PHP4 class that was modified from the PEAR service to > >> stand along and let you do the same thing. I can send it to you. > > >> - Dash - > > >> Fabrizio Moscon wrote: > > >>> I have read many similar posts, but none of that can help me... :( > >>> The question is very simple... > >>> How can I pass a PHP array as parameter hash to new Ajax.Updater > >>> method? > > >>> thanks--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
reading the source code: ''dests'':''[{" dest_flag="" 1="" dest_name="" there''s something very strange! On 26 Mag, 17:54, David Dashifen Kees <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Looks like it''s a good thing to try. Give it a shot and let me know. > As long as that javascript is in a .php file it should work out, or at > least give you more to work with. > > - Dash - > > Fabrizio Moscon wrote: > > Yes, I use PHP5 and I can use either Zend_Framework Json functions... > > so the syntax will be like this: > > > var myAjax = new Ajax.Updater( target, url, {method: ''post'', > > parameters: { ''id_sender'' : ''<?=$s[''id'']?>'' , ''dests'' : (<? > > =json_encode($dests)?>) } } ); > > > is it right? > > > On 26 Mag, 17:28, David Dashifen Kees <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> If you''re using PHP5, then there is a json_encode() function which > >> converts a PHP Array to a JSON string. This can then be put into the > >> parameters property of the Ajax.Updater. If you''re not on PHP5, then > >> post back; I''ve a PHP4 class that was modified from the PEAR service to > >> stand along and let you do the same thing. I can send it to you. > > >> - Dash - > > >> Fabrizio Moscon wrote: > > >>> I have read many similar posts, but none of that can help me... :( > >>> The question is very simple... > >>> How can I pass a PHP array as parameter hash to new Ajax.Updater > >>> method? > > >>> thanks--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I tried on my own pc with PHP5 native json support, but the result don''t change... Javascript console report an "interminated string literal" error near the json array... This is my code: var myAjax = new Ajax.Updater(target,url, {method: ''post'', parameters: {''id_sender'':''<?=$s[''id'']?>'',''dests'':''<?=json_encode($dest)?>''}}); Is there anybody able to help me? On 26 Mag, 18:14, Fabrizio Moscon <mosconfabri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> reading the source code: > ''dests'':''[{" dest_flag="" 1="" dest_name="" > there''s something very strange! > > On 26 Mag, 17:54, David Dashifen Kees <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Looks like it''s a good thing to try. Give it a shot and let me know. > > As long as that javascript is in a .php file it should work out, or at > > least give you more to work with. > > > - Dash - > > > Fabrizio Moscon wrote: > > > Yes, I use PHP5 and I can use either Zend_Framework Json functions... > > > so the syntax will be like this: > > > > var myAjax = new Ajax.Updater( target, url, {method: ''post'', > > > parameters: { ''id_sender'' : ''<?=$s[''id'']?>'' , ''dests'' : (<? > > > =json_encode($dests)?>) } } ); > > > > is it right? > > > > On 26 Mag, 17:28, David Dashifen Kees <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > >> If you''re using PHP5, then there is a json_encode() function which > > >> converts a PHP Array to a JSON string. This can then be put into the > > >> parameters property of the Ajax.Updater. If you''re not on PHP5, then > > >> post back; I''ve a PHP4 class that was modified from the PEAR service to > > >> stand along and let you do the same thing. I can send it to you. > > > >> - Dash - > > > >> Fabrizio Moscon wrote: > > > >>> I have read many similar posts, but none of that can help me... :( > > >>> The question is very simple... > > >>> How can I pass a PHP array as parameter hash to new Ajax.Updater > > >>> method? > > > >>> thanks--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
It''s got to be a problem with the way you''re adding quotation marks. That'' what the unterminated string literal error means. Try taking out the single quotes around your <?=json_encode(...)?> call; I think that function adds quotes all on it''s own. Also, since you used single quotes within your code, if there are any within your $dest array, you''re also going to get this error. - Dash - Fabrizio Moscon wrote:> I tried on my own pc with PHP5 native json support, but the result > don''t change... Javascript console report an "interminated string > literal" error near the json array... > This is my code: > var myAjax = new Ajax.Updater(target,url, {method: ''post'', parameters: > {''id_sender'':''<?=$s[''id'']?>'',''dests'':''<?=json_encode($dest)?>''}}); > > Is there anybody able to help me? > > > On 26 Mag, 18:14, Fabrizio Moscon <mosconfabri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> reading the source code: >> ''dests'':''[{" dest_flag="" 1="" dest_name="" >> there''s something very strange! >> >> On 26 Mag, 17:54, David Dashifen Kees <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >>> Looks like it''s a good thing to try. Give it a shot and let me know. >>> As long as that javascript is in a .php file it should work out, or at >>> least give you more to work with. >>> >>> - Dash - >>> >>> Fabrizio Moscon wrote: >>> >>>> Yes, I use PHP5 and I can use either Zend_Framework Json functions... >>>> so the syntax will be like this: >>>> >>>> var myAjax = new Ajax.Updater( target, url, {method: ''post'', >>>> parameters: { ''id_sender'' : ''<?=$s[''id'']?>'' , ''dests'' : (<? >>>> =json_encode($dests)?>) } } ); >>>> >>>> is it right? >>>> >>>> On 26 Mag, 17:28, David Dashifen Kees <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>> >>>>> If you''re using PHP5, then there is a json_encode() function which >>>>> converts a PHP Array to a JSON string. This can then be put into the >>>>> parameters property of the Ajax.Updater. If you''re not on PHP5, then >>>>> post back; I''ve a PHP4 class that was modified from the PEAR service to >>>>> stand along and let you do the same thing. I can send it to you. >>>>> >>>>> - Dash - >>>>> >>>>> Fabrizio Moscon wrote: >>>>> >>>>>> I have read many similar posts, but none of that can help me... :( >>>>>> The question is very simple... >>>>>> How can I pass a PHP array as parameter hash to new Ajax.Updater >>>>>> method? >>>>>> >>>>>> thanks >>>>>> > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
maybe I''m missing something I didn''t know about php, but why not this: {''id_sender'':''<? echo $s[''id'']; ?>'',''dests'':''<? echo json_encode($dest); ?>''}}); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
That''s what I would suspect, but I don''t know how he''s arranged the specific values of the $dest array. - Dash - Lisa B wrote:> maybe I''m missing something I didn''t know about php, but why not this: > > {''id_sender'':''<? echo $s[''id'']; ?>'',''dests'':''<? echo > json_encode($dest); ?>''}}); > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---