Hi Danilo, If you''re using GET, then the parameters are appended to the URL. If you use POST, they are sent in the body of the request. If you''re really sending 100+ parameters in the querystring, then that''s going to be an awfully long URL - this might be the cause of your problem. Regardless of which HTTP method you use, you might want to question why you''re sending so much data back and forth. From your code, it looks like you are passing params to the Ajax.Request directly from the request parameters of the page that generated the code. Why post them all back to the server, when they''ve already just come from the server? Shouldn''t you be storing them in the server-side session instead? Hope that helps, Dave -- Author: Prototype & Scriptaculous in Action, Ajax in Practice, Ajax in Action On Friday 08 June 2007 16:03, Danilo Luiz Rheinheimer wrote:> Hi, > > > > I am with a problem on a ajax call. > > It looks like the request never hit the server. > > > > The code is like this : > > > > var answersJson = Object.toJSON(resultado); > > alert(answersJson); > > new Ajax.Request(''/avaliacao/json/salvaQuestionario.json'', { > > method:''get'', > > parameters: { > > resultado : answersJson, > > ano : <%=request.getParameter("ano")%>, > > codTurma : <%=request.getParameter("codTurma")%>, > > codCurso : <%=request.getParameter("codCurso")%>, > > codQuestionario : <%=request.getParameter("codQuestionario")%>}, > > onSuccess: function(transport) { > > alert(''ok''); > > voltarInicio(); > > }, > > onFailure: function(transport){ showErrorMessage(''salvaQuestionario'', > transport); } > > }); > > > > The first alert show the value without problems : > > > > [{"id" : 1, "answer" : 3}, {"id" : 2, "answer" : 1}, {"id" : 3, "answer" > : 5}, {"id" : 4, "answer" : 2}] > > > > On this example the array has only 4 elements, but on real use it has > something like 100 elements. > > > > On Firefox all works. > > On IE sometimes the ''/avaliacao/json/salvaQuestionario.json'' is never > called. The alert(''ok'') is of course not show. > > Whant I change the method of the request to ''post'' looks like it works > ok. > > > > But I want to know what the problem really is to fix other places where > this can happen. > > > > Any help please ? > > > > Danilo. > > > > > > ___________________________________________________________________________ >_________ Moody friends. Drama queens. Your life? Nope! - their life, your > story. Play Sims Stories at Yahoo! Games. http://sims.yahoo.com/ > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, I am with a problem on a ajax call. It looks like the request never hit the server. The code is like this : var answersJson = Object.toJSON(resultado); alert(answersJson); new Ajax.Request(''/avaliacao/json/salvaQuestionario.json'', { method:''get'', parameters: { resultado : answersJson, ano : <%=request.getParameter("ano")%>, codTurma : <%=request.getParameter("codTurma")%>, codCurso : <%=request.getParameter("codCurso")%>, codQuestionario : <%=request.getParameter("codQuestionario")%>}, onSuccess: function(transport) { alert(''ok''); voltarInicio(); }, onFailure: function(transport){ showErrorMessage(''salvaQuestionario'', transport); } }); The first alert show the value without problems : [{"id" : 1, "answer" : 3}, {"id" : 2, "answer" : 1}, {"id" : 3, "answer" : 5}, {"id" : 4, "answer" : 2}] On this example the array has only 4 elements, but on real use it has something like 100 elements. On Firefox all works. On IE sometimes the ''/avaliacao/json/salvaQuestionario.json'' is never called. The alert(''ok'') is of course not show. Whant I change the method of the request to ''post'' looks like it works ok. But I want to know what the problem really is to fix other places where this can happen. Any help please ? Danilo. ____________________________________________________________________________________ Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. http://sims.yahoo.com/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Dave, --- Dave Crane <dave-Sy7q136SasSXmMXjJBpWqg@public.gmane.org> wrote:> > If you''re really sending 100+ parameters in the > querystring, then that''s going > to be an awfully long URL - this might be the cause > of your problem. >Ok. I understand this. I just want be sure this is the cause of the problem. I am just starting to develop with ajax and want to know if I am doing the things right.> Regardless of which HTTP method you use, you might > want to question why you''re > sending so much data back and forth. From your code, > it looks like you are > passing params to the Ajax.Request directly from the > request parameters of > the page that generated the code. Why post them all > back to the server, when > they''ve already just come from the server? Shouldn''t > you be storing them in > the server-side session instead? >This is not true. The ''resultado'' variable is populated with information edited by the user. I have a set of questions on the page with some options to the user choose. The ''resultado'' contains key (question id) and value (question answers) of this options. <tr> <td>1.1 - Informa o programa da disciplina</td> <td><input type="radio" name="group1" id="radio:1:1"/></td> <td><input type="radio" name="group1" id="radio:1:1"/></td> <td><input type="radio" name="group1" id="radio:1:1"/></td> </tr> <tr> <td>1.2 - Demonstra domínio nos conteúdos desenvolvidos na disciplina</td> <td><input type="radio" name="group1" id="radio:1:1"/></td> <td><input type="radio" name="group1" id="radio:1:1"/></td> <td><input type="radio" name="group1" id="radio:1:1"/></td> </tr> Anyway thanks for your help. Danilo. ____________________________________________________________________________________ Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Fri, 2007-06-08 at 11:54 +0100, Dave Crane wrote:> Hi Danilo, > > If you''re using GET, then the parameters are appended to the URL. If you use > POST, they are sent in the body of the request. > > If you''re really sending 100+ parameters in the querystring, then that''s going > to be an awfully long URL - this might be the cause of your problem. >There has been, in the past, a limit to the size of the GET, which was enforced differently by different browsers. Given the number of parameters, and that it works with Firefox and not IE, I''m betting that is the case. In the past IE had a much smaller limit to the size of the GET than what was accepted by browsers in the Netscape family. It appears as though it still happens. URLEncoding the data only compounds the issue. The fix is to either not send so much data or to use POST.... Matt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---