Hi,
I am trying to use the Ajax.Request object and am having some trouble
with it.
While the following construct works:
new Ajax.Request(''/todo/add'', {
method: ''get'',
parameters: ''description='' +
encodeURIComponent(document.formAddToDo.todo_description.value),
onSuccess: function (transport) {
new Ajax.Updater(''listToDo'',
''/todo/list'', { });
document.formAddToDo.todo_description.value = '''';
}
});
replacing the parameters section with:
parameters: description: document.formAddToDo.todo_description.value
does NOT.
Any ideas as to what''s causing the problem?
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
-~----------~----~----~----~------~----~------~--~---
> parameters: description: document.formAddToDo.todo_description.valueEr... Did you really forget the curly brackets that would make that an anonymous object? parameters: { description: doc.... } BTW, did you check that "document.formAddToDo...." thing in FF/Safari/etc. ? I''m not entirely sure it''s not just a MSIE thing. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
My bad. I did forget the curly brackets when I posted, but my code did include them and it still didn''t work. My dev environment is FF on Linux. It would have to ultimately work in MSIE, etc, but for now I am just trying to get it working on FF. I would appreciate any ideas/comments. On Mar 30, 1:39 am, Christophe Porteneuve <t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> > parameters: description: document.formAddToDo.todo_description.value > > Er... Did you really forget the curly brackets that would make that an > anonymous object? > > parameters: { description: doc.... } > > BTW, did you check that "document.formAddToDo...." thing in > FF/Safari/etc. ? I''m not entirely sure it''s not just a MSIE thing. > > -- > Christophe Porteneuve aka TDD > t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey there, OK, so can you please either put a minimalistic reproduction of your bug online, or post the necessary source code here (JS fragment, HTML fragment, including any necessary parts to reproduce your issue, such as the JS parts binding event listeners, the HTML parts loading the scripts, etc.). -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Figured this out. Somehow I got it to work, not sure what the issue was initially. Thanks for your help. On Mar 30, 5:09 am, Christophe Porteneuve <t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> Hey there, > > OK, so can you please either put a minimalistic reproduction of your bug > online, or post the necessary source code here (JS fragment, HTML > fragment, including any necessary parts to reproduce your issue, such as > the JS parts binding event listeners, the HTML parts loading the > scripts, etc.). > > -- > Christophe Porteneuve aka TDD > t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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 have this function doing a Ajax.Request. However, when I am looking at the
POST array that I get to my script it does not contain the + sign in the
"phone number" that I might enter.
function submitSignup() {
var success = function(t) { submitSignupSuccess(t); }
var failure = function(t) { submitSignupFailure(t); }
var url = "signup.php?action=register";
var pars = "firstname=" + $F(''firstname'');
pars += "&lastname=" + $F(''lastname'');
pars += "&title=" + $F(''title'');
pars += "&phone=" + $F(''phone'');
pars += "&email=" + $F(''email'');
var req= new Ajax.Request(url, {method: ''post'',
postBody:pars, onSuccess: success, onFailure: failure});
}
function submitSignupSuccess(t) {
//do some stuff
}
function submitSignupFailure(t) {
//do some stuff
}
Any insights in this?
/Peter
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Sorry guys, I used this msg in my outlook to send a message to this group, but it changed the subject of it somehow. I now know I shouldn''t reply and just change subject :) --~--~---------~--~----~------------~-------~--~----~ 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 did it again, but this time I posted it thru the google groups site. Hrm, weird. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey Peter,
You''re not encoding your URL components properly (''+''
is a reserved char
in URLs). Use the serialize() methods on your elements, or even your
whole form (as you seem to be serializing a complete form here) in order
to get the proper representation.
--
Christophe Porteneuve a.k.a. TDD
"[They] did not know it was impossible, so they did it." --Mark Twain
Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---