This was moved from Prototype: Core andymadonna -me Hi, I''m new to using Prototype. I trying to use Ajax to make an interactive timeline of the 60s, but my Ajax request keeps failing. I have it on my live site for testing: http://the60s.andrewmadonna.com/timeline.html Here is a code snippet of the actual request: new Ajax.Request(''timeline_backend.php'', { method: ''get'', parameters: {action: ''year'', year: request_year}, onCreate: create_loader(), onFailure: alert("Oops!"), onSuccess: create_year(transport) }); -------------------------------- Tom Gregory You are not passing function references to the callbacks as you perhaps intend. You are instead passing the results of functions. Modify these lines: onCreate: create_loader, // No parenthesis onFailure: function () {alert("Oops!");}, // anonymous function onSuccess: create_year // Again, use a function reference, not a function result --------------------------------- andymadonna Thanks Tom, I modified it to what you said. But now it doesn''t create the loader, and I know its executing the create_year function because I put in an alert to test it but it doesn''t perform anything past that. Modified: new Ajax.Request(''timeline_backend.php'', { method: ''get'', parameters: {action: ''year'', year: request_year}, onCreate: create_loader, onFailure: function () {alert("Oops!");}, onSuccess: create_year }); --------------------------------------- Gareth Evans What is in your create_year function? ---------------------------------------- andymadonna Hi Gareth, The create_year function creates all the dates for that year on the timeline. I have it on my live site to test the code: http://the60s.andrewmadonna.com/timeline.html Here is the actual function: function create_year(transport) { alert("I am being executed!"); var timeline_content = document.createElement("div"); timeline_content.setAttribute("id","timeline_content"); var timeline = document.createElement("div"); timeline.setAttribute("id","timeline"); var line = document.createElement("div"); line.setAttribute("id","line"); var xmlDoc = transport.responseXML.documentElement; var loop_length = xmlDoc.getElementByTagName("date").length; var isBottom = false; for (var i=0;i<loop_length;i++) { var date_title = xmlDoc.getElementByTagName("date") [i].childNodes[0].childNodes[0].nodeValue; var date_text document.createTextNode(xmlDoc.getElementByTagName("date") [i].childNodes[1].nodeValue); var date = document.createElement("div"); date.setAttribute("title",date_title); var date_line = document.createElement("div"); date_line.setAttribute("class","date_line"); if (!isBottom) { date.setAttribute("class","date"); date.appendChild(date_text); date.appendChild(date_line); isBottom = true; } else { date.setAttribute("class","date_bottom"); date.appendChild(date_line); var date_bottom_text = document.createElement("div"); date_bottom_text.setAttribute("class","date_element_text"); date_bottom_text.appendChild(date_text); date.appendChild(date_bottom_text); isBottom = false; } timeline.appendChild(date); } timeline.appendChild(line); timeline_content.appendChild(timeline); var next_arrow = document.createElement("div"); next_arrow.setAttribute("id","next"); next_arrow.setAttribute("class","arrows"); next_arrow.setAttribute("onclick","slide_timeline_next();"); var next_arrow_text = document.createTextNode("><br /><br /><br />>");next_arrow.appendChild(next_arrow_text); timeline_content.appendChild(next_arrow); var previous_arrow = document.createElement("div"); previous_arrow.setAttribute("id","previous"); previous_arrow.setAttribute("class","arrows"); previous_arrow.setAttribute("onclick","slide_timeline_previous();"); var previous_arrow_text = document.createTextNode("<<br /><br /><br /><");previous_arrow.appendChild(previous_arrow_text); timeline_content.appendChild(previous_arrow); document.body.appendChild(timeline_content); $(''timeline'').setStyle({ width: 8 * loop_length + ''em'' }); } ---------------------------------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
AndyMadonna, When I click any year past 1960 I don''t get the alert at all- is request_year bringing back the correct data? On 3/19/07, andymadonna <andymadonna-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:> > > This was moved from Prototype: Core > > andymadonna -me > > Hi, I''m new to using Prototype. I trying to use Ajax to make an > interactive timeline of the 60s, but my Ajax request keeps failing. > > I have it on my live site for testing: > http://the60s.andrewmadonna.com/timeline.html > > Here is a code snippet of the actual request: > > new Ajax.Request(''timeline_backend.php'', { > method: ''get'', > parameters: {action: ''year'', year: request_year}, > onCreate: create_loader(), > onFailure: alert("Oops!"), > onSuccess: create_year(transport) > }); > > > -------------------------------- > Tom Gregory > > You are not passing function references to the callbacks as you > perhaps intend. You are instead passing the results of functions. > > Modify these lines: > onCreate: create_loader, // No parenthesis > onFailure: function () {alert("Oops!");}, // anonymous function > onSuccess: create_year // Again, use a function reference, not a > function result > --------------------------------- > andymadonna > > Thanks Tom, > > I modified it to what you said. But now it doesn''t create the loader, > and I know its executing the create_year function because I put in an > alert to test it but it doesn''t perform anything past that. > > Modified: > new Ajax.Request(''timeline_backend.php'', { > method: ''get'', > parameters: {action: ''year'', year: request_year}, > onCreate: create_loader, > onFailure: function () {alert("Oops!");}, > onSuccess: create_year > }); > > --------------------------------------- > Gareth Evans > > What is in your create_year function? > > ---------------------------------------- > andymadonna > > Hi Gareth, > > The create_year function creates all the dates for that year on the > timeline. I have it on my live site to test the code: > http://the60s.andrewmadonna.com/timeline.html > > Here is the actual function: > > function create_year(transport) { > alert("I am being executed!"); > var timeline_content = document.createElement("div"); > timeline_content.setAttribute("id","timeline_content"); > var timeline = document.createElement("div"); > timeline.setAttribute("id","timeline"); > var line = document.createElement("div"); > line.setAttribute("id","line"); > var xmlDoc = transport.responseXML.documentElement; > var loop_length = xmlDoc.getElementByTagName("date").length; > var isBottom = false; > for (var i=0;i<loop_length;i++) { > var date_title = xmlDoc.getElementByTagName("date") > [i].childNodes[0].childNodes[0].nodeValue; > var date_text > document.createTextNode(xmlDoc.getElementByTagName("date") > [i].childNodes[1].nodeValue); > var date = document.createElement("div"); > date.setAttribute("title",date_title); > var date_line = document.createElement("div"); > date_line.setAttribute("class","date_line"); > if (!isBottom) { > date.setAttribute("class","date"); > date.appendChild(date_text); > date.appendChild(date_line); > isBottom = true; > } else { > date.setAttribute("class","date_bottom"); > date.appendChild(date_line); > var date_bottom_text = document.createElement("div"); > > date_bottom_text.setAttribute("class","date_element_text"); > date_bottom_text.appendChild(date_text); > date.appendChild(date_bottom_text); > isBottom = false; > } > timeline.appendChild(date); > } > timeline.appendChild(line); > timeline_content.appendChild(timeline); > > var next_arrow = document.createElement("div"); > next_arrow.setAttribute("id","next"); > next_arrow.setAttribute("class","arrows"); > next_arrow.setAttribute("onclick","slide_timeline_next();"); > var next_arrow_text = document.createTextNode("><br /><br / > ><br />>"); > > next_arrow.appendChild(next_arrow_text); > timeline_content.appendChild(next_arrow); > > var previous_arrow = document.createElement("div"); > previous_arrow.setAttribute("id","previous"); > previous_arrow.setAttribute("class","arrows"); > > previous_arrow.setAttribute("onclick","slide_timeline_previous();"); > var previous_arrow_text = document.createTextNode("<<br / > ><br /><br /><"); > > previous_arrow.appendChild(previous_arrow_text); > timeline_content.appendChild(previous_arrow); > > document.body.appendChild(timeline_content); > $(''timeline'').setStyle({ > width: 8 * loop_length + ''em'' > }); > > } > > > ---------------------------------- > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 Gareth, Oh, yes I didn''t add the onclick attribute to those years yet, sorry about that. Thanks On Mar 18, 9:17 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> AndyMadonna, When I click any year past 1960 I don''t get the alert at all- > is request_year bringing back the correct data? > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > This was moved from Prototype: Core > > > andymadonna -me > > > Hi, I''m new to using Prototype. I trying to use Ajax to make an > > interactive timeline of the 60s, but my Ajax request keeps failing. > > > I have it on my live site for testing: > >http://the60s.andrewmadonna.com/timeline.html > > > Here is a code snippet of the actual request: > > > new Ajax.Request(''timeline_backend.php'', { > > method: ''get'', > > parameters: {action: ''year'', year: request_year}, > > onCreate: create_loader(), > > onFailure: alert("Oops!"), > > onSuccess: create_year(transport) > > }); > > > -------------------------------- > > Tom Gregory > > > You are not passing function references to the callbacks as you > > perhaps intend. You are instead passing the results of functions. > > > Modify these lines: > > onCreate: create_loader, // No parenthesis > > onFailure: function () {alert("Oops!");}, // anonymous function > > onSuccess: create_year // Again, use a function reference, not a > > function result > > --------------------------------- > > andymadonna > > > Thanks Tom, > > > I modified it to what you said. But now it doesn''t create the loader, > > and I know its executing the create_year function because I put in an > > alert to test it but it doesn''t perform anything past that. > > > Modified: > > new Ajax.Request(''timeline_backend.php'', { > > method: ''get'', > > parameters: {action: ''year'', year: request_year}, > > onCreate: create_loader, > > onFailure: function () {alert("Oops!");}, > > onSuccess: create_year > > }); > > > --------------------------------------- > > Gareth Evans > > > What is in your create_year function? > > > ---------------------------------------- > > andymadonna > > > Hi Gareth, > > > The create_year function creates all the dates for that year on the > > timeline. I have it on my live site to test the code: > >http://the60s.andrewmadonna.com/timeline.html > > > Here is the actual function: > > > function create_year(transport) { > > alert("I am being executed!"); > > var timeline_content = document.createElement("div"); > > timeline_content.setAttribute("id","timeline_content"); > > var timeline = document.createElement("div"); > > timeline.setAttribute("id","timeline"); > > var line = document.createElement("div"); > > line.setAttribute("id","line"); > > var xmlDoc = transport.responseXML.documentElement; > > var loop_length = xmlDoc.getElementByTagName("date").length; > > var isBottom = false; > > for (var i=0;i<loop_length;i++) { > > var date_title = xmlDoc.getElementByTagName("date") > > [i].childNodes[0].childNodes[0].nodeValue; > > var date_text > > document.createTextNode(xmlDoc.getElementByTagName("date") > > [i].childNodes[1].nodeValue); > > var date = document.createElement("div"); > > date.setAttribute("title",date_title); > > var date_line = document.createElement("div"); > > date_line.setAttribute("class","date_line"); > > if (!isBottom) { > > date.setAttribute("class","date"); > > date.appendChild(date_text); > > date.appendChild(date_line); > > isBottom = true; > > } else { > > date.setAttribute("class","date_bottom"); > > date.appendChild(date_line); > > var date_bottom_text = document.createElement("div"); > > > date_bottom_text.setAttribute("class","date_element_text"); > > date_bottom_text.appendChild(date_text); > > date.appendChild(date_bottom_text); > > isBottom = false; > > } > > timeline.appendChild(date); > > } > > timeline.appendChild(line); > > timeline_content.appendChild(timeline); > > > var next_arrow = document.createElement("div"); > > next_arrow.setAttribute("id","next"); > > next_arrow.setAttribute("class","arrows"); > > next_arrow.setAttribute("onclick","slide_timeline_next();"); > > var next_arrow_text = document.createTextNode("><br /><br / > > ><br />>"); > > > next_arrow.appendChild(next_arrow_text); > > timeline_content.appendChild(next_arrow); > > > var previous_arrow = document.createElement("div"); > > previous_arrow.setAttribute("id","previous"); > > previous_arrow.setAttribute("class","arrows"); > > > previous_arrow.setAttribute("onclick","slide_timeline_previous();"); > > var previous_arrow_text = document.createTextNode("<<br / > > ><br /><br /><"); > > > previous_arrow.appendChild(previous_arrow_text); > > timeline_content.appendChild(previous_arrow); > > > document.body.appendChild(timeline_content); > > $(''timeline'').setStyle({ > > width: 8 * loop_length + ''em'' > > }); > > > } > > > ------------------------------------~--~---------~--~----~------------~-------~--~----~ 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 added the onclicks to the rest of the years. And if your wondering what the final result is supposed to look like I uploaded the page I used to test the CSS: http://the60s.andrewmadonna.com/timeline_year.html On Mar 18, 10:01 pm, "andymadonna" <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:> Hi Gareth, > > Oh, yes I didn''t add the onclick attribute to those years yet, sorry > about that. > > Thanks > > On Mar 18, 9:17 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > AndyMadonna, When I click any year past 1960 I don''t get the alert at all- > > is request_year bringing back the correct data? > > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > This was moved from Prototype: Core > > > > andymadonna -me > > > > Hi, I''m new to using Prototype. I trying to use Ajax to make an > > > interactive timeline of the 60s, but my Ajax request keeps failing. > > > > I have it on my live site for testing: > > >http://the60s.andrewmadonna.com/timeline.html > > > > Here is a code snippet of the actual request: > > > > new Ajax.Request(''timeline_backend.php'', { > > > method: ''get'', > > > parameters: {action: ''year'', year: request_year}, > > > onCreate: create_loader(), > > > onFailure: alert("Oops!"), > > > onSuccess: create_year(transport) > > > }); > > > > -------------------------------- > > > Tom Gregory > > > > You are not passing function references to the callbacks as you > > > perhaps intend. You are instead passing the results of functions. > > > > Modify these lines: > > > onCreate: create_loader, // No parenthesis > > > onFailure: function () {alert("Oops!");}, // anonymous function > > > onSuccess: create_year // Again, use a function reference, not a > > > function result > > > --------------------------------- > > > andymadonna > > > > Thanks Tom, > > > > I modified it to what you said. But now it doesn''t create the loader, > > > and I know its executing the create_year function because I put in an > > > alert to test it but it doesn''t perform anything past that. > > > > Modified: > > > new Ajax.Request(''timeline_backend.php'', { > > > method: ''get'', > > > parameters: {action: ''year'', year: request_year}, > > > onCreate: create_loader, > > > onFailure: function () {alert("Oops!");}, > > > onSuccess: create_year > > > }); > > > > --------------------------------------- > > > Gareth Evans > > > > What is in your create_year function? > > > > ---------------------------------------- > > > andymadonna > > > > Hi Gareth, > > > > The create_year function creates all the dates for that year on the > > > timeline. I have it on my live site to test the code: > > >http://the60s.andrewmadonna.com/timeline.html > > > > Here is the actual function: > > > > function create_year(transport) { > > > alert("I am being executed!"); > > > var timeline_content = document.createElement("div"); > > > timeline_content.setAttribute("id","timeline_content"); > > > var timeline = document.createElement("div"); > > > timeline.setAttribute("id","timeline"); > > > var line = document.createElement("div"); > > > line.setAttribute("id","line"); > > > var xmlDoc = transport.responseXML.documentElement; > > > var loop_length = xmlDoc.getElementByTagName("date").length; > > > var isBottom = false; > > > for (var i=0;i<loop_length;i++) { > > > var date_title = xmlDoc.getElementByTagName("date") > > > [i].childNodes[0].childNodes[0].nodeValue; > > > var date_text > > > document.createTextNode(xmlDoc.getElementByTagName("date") > > > [i].childNodes[1].nodeValue); > > > var date = document.createElement("div"); > > > date.setAttribute("title",date_title); > > > var date_line = document.createElement("div"); > > > date_line.setAttribute("class","date_line"); > > > if (!isBottom) { > > > date.setAttribute("class","date"); > > > date.appendChild(date_text); > > > date.appendChild(date_line); > > > isBottom = true; > > > } else { > > > date.setAttribute("class","date_bottom"); > > > date.appendChild(date_line); > > > var date_bottom_text = document.createElement("div"); > > > > date_bottom_text.setAttribute("class","date_element_text"); > > > date_bottom_text.appendChild(date_text); > > > date.appendChild(date_bottom_text); > > > isBottom = false; > > > } > > > timeline.appendChild(date); > > > } > > > timeline.appendChild(line); > > > timeline_content.appendChild(timeline); > > > > var next_arrow = document.createElement("div"); > > > next_arrow.setAttribute("id","next"); > > > next_arrow.setAttribute("class","arrows"); > > > next_arrow.setAttribute("onclick","slide_timeline_next();"); > > > var next_arrow_text = document.createTextNode("><br /><br / > > > ><br />>"); > > > > next_arrow.appendChild(next_arrow_text); > > > timeline_content.appendChild(next_arrow); > > > > var previous_arrow = document.createElement("div"); > > > previous_arrow.setAttribute("id","previous"); > > > previous_arrow.setAttribute("class","arrows"); > > > > previous_arrow.setAttribute("onclick","slide_timeline_previous();"); > > > var previous_arrow_text = document.createTextNode("<<br / > > > ><br /><br /><"); > > > > previous_arrow.appendChild(previous_arrow_text); > > > timeline_content.appendChild(previous_arrow); > > > > document.body.appendChild(timeline_content); > > > $(''timeline'').setStyle({ > > > width: 8 * loop_length + ''em'' > > > }); > > > > } > > > > ------------------------------------~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
are you setting text/xml as your content type in your http header in your php page? I think responseXML might only be available if you do that. Gareth On 3/19/07, andymadonna <andymadonna-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:> > > I added the onclicks to the rest of the years. And if your wondering > what the final result is supposed to look like I uploaded the page I > used to test the CSS: http://the60s.andrewmadonna.com/timeline_year.html > > On Mar 18, 10:01 pm, "andymadonna" <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > Hi Gareth, > > > > Oh, yes I didn''t add the onclick attribute to those years yet, sorry > > about that. > > > > Thanks > > > > On Mar 18, 9:17 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > AndyMadonna, When I click any year past 1960 I don''t get the alert at > all- > > > is request_year bringing back the correct data? > > > > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > > This was moved from Prototype: Core > > > > > > andymadonna -me > > > > > > Hi, I''m new to using Prototype. I trying to use Ajax to make an > > > > interactive timeline of the 60s, but my Ajax request keeps failing. > > > > > > I have it on my live site for testing: > > > >http://the60s.andrewmadonna.com/timeline.html > > > > > > Here is a code snippet of the actual request: > > > > > > new Ajax.Request(''timeline_backend.php'', { > > > > method: ''get'', > > > > parameters: {action: ''year'', year: request_year}, > > > > onCreate: create_loader(), > > > > onFailure: alert("Oops!"), > > > > onSuccess: create_year(transport) > > > > }); > > > > > > -------------------------------- > > > > Tom Gregory > > > > > > You are not passing function references to the callbacks as you > > > > perhaps intend. You are instead passing the results of functions. > > > > > > Modify these lines: > > > > onCreate: create_loader, // No parenthesis > > > > onFailure: function () {alert("Oops!");}, // anonymous function > > > > onSuccess: create_year // Again, use a function reference, not a > > > > function result > > > > --------------------------------- > > > > andymadonna > > > > > > Thanks Tom, > > > > > > I modified it to what you said. But now it doesn''t create the > loader, > > > > and I know its executing the create_year function because I put in > an > > > > alert to test it but it doesn''t perform anything past that. > > > > > > Modified: > > > > new Ajax.Request(''timeline_backend.php'', { > > > > method: ''get'', > > > > parameters: {action: ''year'', year: request_year}, > > > > onCreate: create_loader, > > > > onFailure: function () {alert("Oops!");}, > > > > onSuccess: create_year > > > > }); > > > > > > --------------------------------------- > > > > Gareth Evans > > > > > > What is in your create_year function? > > > > > > ---------------------------------------- > > > > andymadonna > > > > > > Hi Gareth, > > > > > > The create_year function creates all the dates for that year on the > > > > timeline. I have it on my live site to test the code: > > > >http://the60s.andrewmadonna.com/timeline.html > > > > > > Here is the actual function: > > > > > > function create_year(transport) { > > > > alert("I am being executed!"); > > > > var timeline_content = document.createElement("div"); > > > > timeline_content.setAttribute("id","timeline_content"); > > > > var timeline = document.createElement("div"); > > > > timeline.setAttribute("id","timeline"); > > > > var line = document.createElement("div"); > > > > line.setAttribute("id","line"); > > > > var xmlDoc = transport.responseXML.documentElement; > > > > var loop_length = xmlDoc.getElementByTagName("date").length; > > > > var isBottom = false; > > > > for (var i=0;i<loop_length;i++) { > > > > var date_title = xmlDoc.getElementByTagName("date") > > > > [i].childNodes[0].childNodes[0].nodeValue; > > > > var date_text > > > > document.createTextNode(xmlDoc.getElementByTagName("date") > > > > [i].childNodes[1].nodeValue); > > > > var date = document.createElement("div"); > > > > date.setAttribute("title",date_title); > > > > var date_line = document.createElement("div"); > > > > date_line.setAttribute("class","date_line"); > > > > if (!isBottom) { > > > > date.setAttribute("class","date"); > > > > date.appendChild(date_text); > > > > date.appendChild(date_line); > > > > isBottom = true; > > > > } else { > > > > date.setAttribute("class","date_bottom"); > > > > date.appendChild(date_line); > > > > var date_bottom_text = document.createElement("div"); > > > > > > date_bottom_text.setAttribute("class","date_element_text"); > > > > date_bottom_text.appendChild(date_text); > > > > date.appendChild(date_bottom_text); > > > > isBottom = false; > > > > } > > > > timeline.appendChild(date); > > > > } > > > > timeline.appendChild(line); > > > > timeline_content.appendChild(timeline); > > > > > > var next_arrow = document.createElement("div"); > > > > next_arrow.setAttribute("id","next"); > > > > next_arrow.setAttribute("class","arrows"); > > > > next_arrow.setAttribute("onclick","slide_timeline_next();"); > > > > var next_arrow_text = document.createTextNode("><br /><br / > > > > ><br />>"); > > > > > > next_arrow.appendChild(next_arrow_text); > > > > timeline_content.appendChild(next_arrow); > > > > > > var previous_arrow = document.createElement("div"); > > > > previous_arrow.setAttribute("id","previous"); > > > > previous_arrow.setAttribute("class","arrows"); > > > > > > previous_arrow.setAttribute("onclick","slide_timeline_previous();"); > > > > var previous_arrow_text = document.createTextNode("<<br / > > > > ><br /><br /><"); > > > > > > previous_arrow.appendChild(previous_arrow_text); > > > > timeline_content.appendChild(previous_arrow); > > > > > > document.body.appendChild(timeline_content); > > > > $(''timeline'').setStyle({ > > > > width: 8 * loop_length + ''em'' > > > > }); > > > > > > } > > > > > > ---------------------------------- > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 Gareth, I didn''t have a content type header on the php page. I added to the code but my hosts FTP is down :( Thanks, I hope my hosts FTP will be back up soon so I can try it On Mar 18, 10:13 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> are you setting text/xml as your content type in your http header in your > php page? > I think responseXML might only be available if you do that. > > Gareth > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > I added the onclicks to the rest of the years. And if your wondering > > what the final result is supposed to look like I uploaded the page I > > used to test the CSS:http://the60s.andrewmadonna.com/timeline_year.html > > > On Mar 18, 10:01 pm, "andymadonna" <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > Hi Gareth, > > > > Oh, yes I didn''t add the onclick attribute to those years yet, sorry > > > about that. > > > > Thanks > > > > On Mar 18, 9:17 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > AndyMadonna, When I click any year past 1960 I don''t get the alert at > > all- > > > > is request_year bringing back the correct data? > > > > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > > This was moved from Prototype: Core > > > > > > andymadonna -me > > > > > > Hi, I''m new to using Prototype. I trying to use Ajax to make an > > > > > interactive timeline of the 60s, but my Ajax request keeps failing. > > > > > > I have it on my live site for testing: > > > > >http://the60s.andrewmadonna.com/timeline.html > > > > > > Here is a code snippet of the actual request: > > > > > > new Ajax.Request(''timeline_backend.php'', { > > > > > method: ''get'', > > > > > parameters: {action: ''year'', year: request_year}, > > > > > onCreate: create_loader(), > > > > > onFailure: alert("Oops!"), > > > > > onSuccess: create_year(transport) > > > > > }); > > > > > > -------------------------------- > > > > > Tom Gregory > > > > > > You are not passing function references to the callbacks as you > > > > > perhaps intend. You are instead passing the results of functions. > > > > > > Modify these lines: > > > > > onCreate: create_loader, // No parenthesis > > > > > onFailure: function () {alert("Oops!");}, // anonymous function > > > > > onSuccess: create_year // Again, use a function reference, not a > > > > > function result > > > > > --------------------------------- > > > > > andymadonna > > > > > > Thanks Tom, > > > > > > I modified it to what you said. But now it doesn''t create the > > loader, > > > > > and I know its executing the create_year function because I put in > > an > > > > > alert to test it but it doesn''t perform anything past that. > > > > > > Modified: > > > > > new Ajax.Request(''timeline_backend.php'', { > > > > > method: ''get'', > > > > > parameters: {action: ''year'', year: request_year}, > > > > > onCreate: create_loader, > > > > > onFailure: function () {alert("Oops!");}, > > > > > onSuccess: create_year > > > > > }); > > > > > > --------------------------------------- > > > > > Gareth Evans > > > > > > What is in your create_year function? > > > > > > ---------------------------------------- > > > > > andymadonna > > > > > > Hi Gareth, > > > > > > The create_year function creates all the dates for that year on the > > > > > timeline. I have it on my live site to test the code: > > > > >http://the60s.andrewmadonna.com/timeline.html > > > > > > Here is the actual function: > > > > > > function create_year(transport) { > > > > > alert("I am being executed!"); > > > > > var timeline_content = document.createElement("div"); > > > > > timeline_content.setAttribute("id","timeline_content"); > > > > > var timeline = document.createElement("div"); > > > > > timeline.setAttribute("id","timeline"); > > > > > var line = document.createElement("div"); > > > > > line.setAttribute("id","line"); > > > > > var xmlDoc = transport.responseXML.documentElement; > > > > > var loop_length = xmlDoc.getElementByTagName("date").length; > > > > > var isBottom = false; > > > > > for (var i=0;i<loop_length;i++) { > > > > > var date_title = xmlDoc.getElementByTagName("date") > > > > > [i].childNodes[0].childNodes[0].nodeValue; > > > > > var date_text > > > > > document.createTextNode(xmlDoc.getElementByTagName("date") > > > > > [i].childNodes[1].nodeValue); > > > > > var date = document.createElement("div"); > > > > > date.setAttribute("title",date_title); > > > > > var date_line = document.createElement("div"); > > > > > date_line.setAttribute("class","date_line"); > > > > > if (!isBottom) { > > > > > date.setAttribute("class","date"); > > > > > date.appendChild(date_text); > > > > > date.appendChild(date_line); > > > > > isBottom = true; > > > > > } else { > > > > > date.setAttribute("class","date_bottom"); > > > > > date.appendChild(date_line); > > > > > var date_bottom_text = document.createElement("div"); > > > > > > date_bottom_text.setAttribute("class","date_element_text"); > > > > > date_bottom_text.appendChild(date_text); > > > > > date.appendChild(date_bottom_text); > > > > > isBottom = false; > > > > > } > > > > > timeline.appendChild(date); > > > > > } > > > > > timeline.appendChild(line); > > > > > timeline_content.appendChild(timeline); > > > > > > var next_arrow = document.createElement("div"); > > > > > next_arrow.setAttribute("id","next"); > > > > > next_arrow.setAttribute("class","arrows"); > > > > > next_arrow.setAttribute("onclick","slide_timeline_next();"); > > > > > var next_arrow_text = document.createTextNode("><br /><br / > > > > > ><br />>"); > > > > > > next_arrow.appendChild(next_arrow_text); > > > > > timeline_content.appendChild(next_arrow); > > > > > > var previous_arrow = document.createElement("div"); > > > > > previous_arrow.setAttribute("id","previous"); > > > > > previous_arrow.setAttribute("class","arrows"); > > > > > > previous_arrow.setAttribute("onclick","slide_timeline_previous();"); > > > > > var previous_arrow_text = document.createTextNode("<<br / > > > > > ><br /><br /><"); > > > > > > previous_arrow.appendChild(previous_arrow_text); > > > > > timeline_content.appendChild(previous_arrow); > > > > > > document.body.appendChild(timeline_content); > > > > > $(''timeline'').setStyle({ > > > > > width: 8 * loop_length + ''em'' > > > > > }); > > > > > > } > > > > > > ------------------------------------~--~---------~--~----~------------~-------~--~----~ 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!!! my FTP just got back up :) But adding the content header didn''t work. On Mar 18, 10:22 pm, "andymadonna" <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:> Hi Gareth, > > I didn''t have a content type header on the php page. I added to the > code but my hosts FTP is down :( > > Thanks, > I hope my hosts FTP will be back up soon so I can try it > > On Mar 18, 10:13 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > are you setting text/xml as your content type in your http header in your > > php page? > > I think responseXML might only be available if you do that. > > > Gareth > > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > I added the onclicks to the rest of the years. And if your wondering > > > what the final result is supposed to look like I uploaded the page I > > > used to test the CSS:http://the60s.andrewmadonna.com/timeline_year.html > > > > On Mar 18, 10:01 pm, "andymadonna" <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > Hi Gareth, > > > > > Oh, yes I didn''t add the onclick attribute to those years yet, sorry > > > > about that. > > > > > Thanks > > > > > On Mar 18, 9:17 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > AndyMadonna, When I click any year past 1960 I don''t get the alert at > > > all- > > > > > is request_year bringing back the correct data? > > > > > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > > > This was moved from Prototype: Core > > > > > > > andymadonna -me > > > > > > > Hi, I''m new to using Prototype. I trying to use Ajax to make an > > > > > > interactive timeline of the 60s, but my Ajax request keeps failing. > > > > > > > I have it on my live site for testing: > > > > > >http://the60s.andrewmadonna.com/timeline.html > > > > > > > Here is a code snippet of the actual request: > > > > > > > new Ajax.Request(''timeline_backend.php'', { > > > > > > method: ''get'', > > > > > > parameters: {action: ''year'', year: request_year}, > > > > > > onCreate: create_loader(), > > > > > > onFailure: alert("Oops!"), > > > > > > onSuccess: create_year(transport) > > > > > > }); > > > > > > > -------------------------------- > > > > > > Tom Gregory > > > > > > > You are not passing function references to the callbacks as you > > > > > > perhaps intend. You are instead passing the results of functions. > > > > > > > Modify these lines: > > > > > > onCreate: create_loader, // No parenthesis > > > > > > onFailure: function () {alert("Oops!");}, // anonymous function > > > > > > onSuccess: create_year // Again, use a function reference, not a > > > > > > function result > > > > > > --------------------------------- > > > > > > andymadonna > > > > > > > Thanks Tom, > > > > > > > I modified it to what you said. But now it doesn''t create the > > > loader, > > > > > > and I know its executing the create_year function because I put in > > > an > > > > > > alert to test it but it doesn''t perform anything past that. > > > > > > > Modified: > > > > > > new Ajax.Request(''timeline_backend.php'', { > > > > > > method: ''get'', > > > > > > parameters: {action: ''year'', year: request_year}, > > > > > > onCreate: create_loader, > > > > > > onFailure: function () {alert("Oops!");}, > > > > > > onSuccess: create_year > > > > > > }); > > > > > > > --------------------------------------- > > > > > > Gareth Evans > > > > > > > What is in your create_year function? > > > > > > > ---------------------------------------- > > > > > > andymadonna > > > > > > > Hi Gareth, > > > > > > > The create_year function creates all the dates for that year on the > > > > > > timeline. I have it on my live site to test the code: > > > > > >http://the60s.andrewmadonna.com/timeline.html > > > > > > > Here is the actual function: > > > > > > > function create_year(transport) { > > > > > > alert("I am being executed!"); > > > > > > var timeline_content = document.createElement("div"); > > > > > > timeline_content.setAttribute("id","timeline_content"); > > > > > > var timeline = document.createElement("div"); > > > > > > timeline.setAttribute("id","timeline"); > > > > > > var line = document.createElement("div"); > > > > > > line.setAttribute("id","line"); > > > > > > var xmlDoc = transport.responseXML.documentElement; > > > > > > var loop_length = xmlDoc.getElementByTagName("date").length; > > > > > > var isBottom = false; > > > > > > for (var i=0;i<loop_length;i++) { > > > > > > var date_title = xmlDoc.getElementByTagName("date") > > > > > > [i].childNodes[0].childNodes[0].nodeValue; > > > > > > var date_text > > > > > > document.createTextNode(xmlDoc.getElementByTagName("date") > > > > > > [i].childNodes[1].nodeValue); > > > > > > var date = document.createElement("div"); > > > > > > date.setAttribute("title",date_title); > > > > > > var date_line = document.createElement("div"); > > > > > > date_line.setAttribute("class","date_line"); > > > > > > if (!isBottom) { > > > > > > date.setAttribute("class","date"); > > > > > > date.appendChild(date_text); > > > > > > date.appendChild(date_line); > > > > > > isBottom = true; > > > > > > } else { > > > > > > date.setAttribute("class","date_bottom"); > > > > > > date.appendChild(date_line); > > > > > > var date_bottom_text = document.createElement("div"); > > > > > > > date_bottom_text.setAttribute("class","date_element_text"); > > > > > > date_bottom_text.appendChild(date_text); > > > > > > date.appendChild(date_bottom_text); > > > > > > isBottom = false; > > > > > > } > > > > > > timeline.appendChild(date); > > > > > > } > > > > > > timeline.appendChild(line); > > > > > > timeline_content.appendChild(timeline); > > > > > > > var next_arrow = document.createElement("div"); > > > > > > next_arrow.setAttribute("id","next"); > > > > > > next_arrow.setAttribute("class","arrows"); > > > > > > next_arrow.setAttribute("onclick","slide_timeline_next();"); > > > > > > var next_arrow_text = document.createTextNode("><br /><br / > > > > > > ><br />>"); > > > > > > > next_arrow.appendChild(next_arrow_text); > > > > > > timeline_content.appendChild(next_arrow); > > > > > > > var previous_arrow = document.createElement("div"); > > > > > > previous_arrow.setAttribute("id","previous"); > > > > > > previous_arrow.setAttribute("class","arrows"); > > > > > > > previous_arrow.setAttribute("onclick","slide_timeline_previous();"); > > > > > > var previous_arrow_text = document.createTextNode("<<br / > > > > > > ><br /><br /><"); > > > > > > > previous_arrow.appendChild(previous_arrow_text); > > > > > > timeline_content.appendChild(previous_arrow); > > > > > > > document.body.appendChild(timeline_content); > > > > > > $(''timeline'').setStyle({ > > > > > > width: 8 * loop_length + ''em'' > > > > > > }); > > > > > > > } > > > > > > > ------------------------------------~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Okay that exhausts my limited debugging ability at this current moment in time. Anyone else got any ideas? I should really get my work done first :) Gareth On 3/19/07, andymadonna <andymadonna-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:> > > YES!!! my FTP just got back up :) > > But adding the content header didn''t work. > > On Mar 18, 10:22 pm, "andymadonna" <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > Hi Gareth, > > > > I didn''t have a content type header on the php page. I added to the > > code but my hosts FTP is down :( > > > > Thanks, > > I hope my hosts FTP will be back up soon so I can try it > > > > On Mar 18, 10:13 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > are you setting text/xml as your content type in your http header in > your > > > php page? > > > I think responseXML might only be available if you do that. > > > > > Gareth > > > > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > > I added the onclicks to the rest of the years. And if your wondering > > > > what the final result is supposed to look like I uploaded the page I > > > > used to test the CSS: > http://the60s.andrewmadonna.com/timeline_year.html > > > > > > On Mar 18, 10:01 pm, "andymadonna" <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > Hi Gareth, > > > > > > > Oh, yes I didn''t add the onclick attribute to those years yet, > sorry > > > > > about that. > > > > > > > Thanks > > > > > > > On Mar 18, 9:17 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > AndyMadonna, When I click any year past 1960 I don''t get the > alert at > > > > all- > > > > > > is request_year bringing back the correct data? > > > > > > > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > > > > > This was moved from Prototype: Core > > > > > > > > > andymadonna -me > > > > > > > > > Hi, I''m new to using Prototype. I trying to use Ajax to make > an > > > > > > > interactive timeline of the 60s, but my Ajax request keeps > failing. > > > > > > > > > I have it on my live site for testing: > > > > > > >http://the60s.andrewmadonna.com/timeline.html > > > > > > > > > Here is a code snippet of the actual request: > > > > > > > > > new Ajax.Request(''timeline_backend.php'', { > > > > > > > method: ''get'', > > > > > > > parameters: {action: ''year'', year: request_year}, > > > > > > > onCreate: create_loader(), > > > > > > > onFailure: alert("Oops!"), > > > > > > > onSuccess: create_year(transport) > > > > > > > }); > > > > > > > > > -------------------------------- > > > > > > > Tom Gregory > > > > > > > > > You are not passing function references to the callbacks as > you > > > > > > > perhaps intend. You are instead passing the results of > functions. > > > > > > > > > Modify these lines: > > > > > > > onCreate: create_loader, // No parenthesis > > > > > > > onFailure: function () {alert("Oops!");}, // anonymous > function > > > > > > > onSuccess: create_year // Again, use a function reference, > not a > > > > > > > function result > > > > > > > --------------------------------- > > > > > > > andymadonna > > > > > > > > > Thanks Tom, > > > > > > > > > I modified it to what you said. But now it doesn''t create the > > > > loader, > > > > > > > and I know its executing the create_year function because I > put in > > > > an > > > > > > > alert to test it but it doesn''t perform anything past that. > > > > > > > > > Modified: > > > > > > > new Ajax.Request(''timeline_backend.php'', { > > > > > > > method: ''get'', > > > > > > > parameters: {action: ''year'', year: request_year}, > > > > > > > onCreate: create_loader, > > > > > > > onFailure: function () {alert("Oops!");}, > > > > > > > onSuccess: create_year > > > > > > > }); > > > > > > > > > --------------------------------------- > > > > > > > Gareth Evans > > > > > > > > > What is in your create_year function? > > > > > > > > > ---------------------------------------- > > > > > > > andymadonna > > > > > > > > > Hi Gareth, > > > > > > > > > The create_year function creates all the dates for that year > on the > > > > > > > timeline. I have it on my live site to test the code: > > > > > > >http://the60s.andrewmadonna.com/timeline.html > > > > > > > > > Here is the actual function: > > > > > > > > > function create_year(transport) { > > > > > > > alert("I am being executed!"); > > > > > > > var timeline_content = document.createElement("div"); > > > > > > > timeline_content.setAttribute("id","timeline_content"); > > > > > > > var timeline = document.createElement("div"); > > > > > > > timeline.setAttribute("id","timeline"); > > > > > > > var line = document.createElement("div"); > > > > > > > line.setAttribute("id","line"); > > > > > > > var xmlDoc = transport.responseXML.documentElement; > > > > > > > var loop_length = xmlDoc.getElementByTagName > ("date").length; > > > > > > > var isBottom = false; > > > > > > > for (var i=0;i<loop_length;i++) { > > > > > > > var date_title = xmlDoc.getElementByTagName("date") > > > > > > > [i].childNodes[0].childNodes[0].nodeValue; > > > > > > > var date_text > > > > > > > document.createTextNode(xmlDoc.getElementByTagName("date") > > > > > > > [i].childNodes[1].nodeValue); > > > > > > > var date = document.createElement("div"); > > > > > > > date.setAttribute("title",date_title); > > > > > > > var date_line = document.createElement("div"); > > > > > > > date_line.setAttribute("class","date_line"); > > > > > > > if (!isBottom) { > > > > > > > date.setAttribute("class","date"); > > > > > > > date.appendChild(date_text); > > > > > > > date.appendChild(date_line); > > > > > > > isBottom = true; > > > > > > > } else { > > > > > > > date.setAttribute("class","date_bottom"); > > > > > > > date.appendChild(date_line); > > > > > > > var date_bottom_text = document.createElement > ("div"); > > > > > > > > > date_bottom_text.setAttribute("class","date_element_text"); > > > > > > > date_bottom_text.appendChild(date_text); > > > > > > > date.appendChild(date_bottom_text); > > > > > > > isBottom = false; > > > > > > > } > > > > > > > timeline.appendChild(date); > > > > > > > } > > > > > > > timeline.appendChild(line); > > > > > > > timeline_content.appendChild(timeline); > > > > > > > > > var next_arrow = document.createElement("div"); > > > > > > > next_arrow.setAttribute("id","next"); > > > > > > > next_arrow.setAttribute("class","arrows"); > > > > > > > > next_arrow.setAttribute("onclick","slide_timeline_next();"); > > > > > > > var next_arrow_text = document.createTextNode("><br > /><br / > > > > > > > ><br />>"); > > > > > > > > > next_arrow.appendChild(next_arrow_text); > > > > > > > timeline_content.appendChild(next_arrow); > > > > > > > > > var previous_arrow = document.createElement("div"); > > > > > > > previous_arrow.setAttribute("id","previous"); > > > > > > > previous_arrow.setAttribute("class","arrows"); > > > > > > > > > > previous_arrow.setAttribute("onclick","slide_timeline_previous();"); > > > > > > > var previous_arrow_text = document.createTextNode("<<br > / > > > > > > > ><br /><br /><"); > > > > > > > > > previous_arrow.appendChild(previous_arrow_text); > > > > > > > timeline_content.appendChild(previous_arrow); > > > > > > > > > document.body.appendChild(timeline_content); > > > > > > > $(''timeline'').setStyle({ > > > > > > > width: 8 * loop_length + ''em'' > > > > > > > }); > > > > > > > > > } > > > > > > > > > ---------------------------------- > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 went to the PHP file with the web browser and it comes out as an XML file. Firefox had the "This XML file does not appear to have any style information associated with it. The document tree is shown below." thing at the top. On Mar 18, 10:30 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Okay that exhausts my limited debugging ability at this current moment in > time. > Anyone else got any ideas? > > I should really get my work done first :) > > Gareth > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > YES!!! my FTP just got back up :) > > > But adding the content header didn''t work. > > > On Mar 18, 10:22 pm, "andymadonna" <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > Hi Gareth, > > > > I didn''t have a content type header on the php page. I added to the > > > code but my hosts FTP is down :( > > > > Thanks, > > > I hope my hosts FTP will be back up soon so I can try it > > > > On Mar 18, 10:13 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > are you setting text/xml as your content type in your http header in > > your > > > > php page? > > > > I think responseXML might only be available if you do that. > > > > > Gareth > > > > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > > I added the onclicks to the rest of the years. And if your wondering > > > > > what the final result is supposed to look like I uploaded the page I > > > > > used to test the CSS: > >http://the60s.andrewmadonna.com/timeline_year.html > > > > > > On Mar 18, 10:01 pm, "andymadonna" <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > > Hi Gareth, > > > > > > > Oh, yes I didn''t add the onclick attribute to those years yet, > > sorry > > > > > > about that. > > > > > > > Thanks > > > > > > > On Mar 18, 9:17 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > AndyMadonna, When I click any year past 1960 I don''t get the > > alert at > > > > > all- > > > > > > > is request_year bringing back the correct data? > > > > > > > > On 3/19/07, andymadonna <andymado...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > > > > > This was moved from Prototype: Core > > > > > > > > > andymadonna -me > > > > > > > > > Hi, I''m new to using Prototype. I trying to use Ajax to make > > an > > > > > > > > interactive timeline of the 60s, but my Ajax request keeps > > failing. > > > > > > > > > I have it on my live site for testing: > > > > > > > >http://the60s.andrewmadonna.com/timeline.html > > > > > > > > > Here is a code snippet of the actual request: > > > > > > > > > new Ajax.Request(''timeline_backend.php'', { > > > > > > > > method: ''get'', > > > > > > > > parameters: {action: ''year'', year: request_year}, > > > > > > > > onCreate: create_loader(), > > > > > > > > onFailure: alert("Oops!"), > > > > > > > > onSuccess: create_year(transport) > > > > > > > > }); > > > > > > > > > -------------------------------- > > > > > > > > Tom Gregory > > > > > > > > > You are not passing function references to the callbacks as > > you > > > > > > > > perhaps intend. You are instead passing the results of > > functions. > > > > > > > > > Modify these lines: > > > > > > > > onCreate: create_loader, // No parenthesis > > > > > > > > onFailure: function () {alert("Oops!");}, // anonymous > > function > > > > > > > > onSuccess: create_year // Again, use a function reference, > > not a > > > > > > > > function result > > > > > > > > --------------------------------- > > > > > > > > andymadonna > > > > > > > > > Thanks Tom, > > > > > > > > > I modified it to what you said. But now it doesn''t create the > > > > > loader, > > > > > > > > and I know its executing the create_year function because I > > put in > > > > > an > > > > > > > > alert to test it but it doesn''t perform anything past that. > > > > > > > > > Modified: > > > > > > > > new Ajax.Request(''timeline_backend.php'', { > > > > > > > > method: ''get'', > > > > > > > > parameters: {action: ''year'', year: request_year}, > > > > > > > > onCreate: create_loader, > > > > > > > > onFailure: function () {alert("Oops!");}, > > > > > > > > onSuccess: create_year > > > > > > > > }); > > > > > > > > > --------------------------------------- > > > > > > > > Gareth Evans > > > > > > > > > What is in your create_year function? > > > > > > > > > ---------------------------------------- > > > > > > > > andymadonna > > > > > > > > > Hi Gareth, > > > > > > > > > The create_year function creates all the dates for that year > > on the > > > > > > > > timeline. I have it on my live site to test the code: > > > > > > > >http://the60s.andrewmadonna.com/timeline.html > > > > > > > > > Here is the actual function: > > > > > > > > > function create_year(transport) { > > > > > > > > alert("I am being executed!"); > > > > > > > > var timeline_content = document.createElement("div"); > > > > > > > > timeline_content.setAttribute("id","timeline_content"); > > > > > > > > var timeline = document.createElement("div"); > > > > > > > > timeline.setAttribute("id","timeline"); > > > > > > > > var line = document.createElement("div"); > > > > > > > > line.setAttribute("id","line"); > > > > > > > > var xmlDoc = transport.responseXML.documentElement; > > > > > > > > var loop_length = xmlDoc.getElementByTagName > > ("date").length; > > > > > > > > var isBottom = false; > > > > > > > > for (var i=0;i<loop_length;i++) { > > > > > > > > var date_title = xmlDoc.getElementByTagName("date") > > > > > > > > [i].childNodes[0].childNodes[0].nodeValue; > > > > > > > > var date_text > > > > > > > > document.createTextNode(xmlDoc.getElementByTagName("date") > > > > > > > > [i].childNodes[1].nodeValue); > > > > > > > > var date = document.createElement("div"); > > > > > > > > date.setAttribute("title",date_title); > > > > > > > > var date_line = document.createElement("div"); > > > > > > > > date_line.setAttribute("class","date_line"); > > > > > > > > if (!isBottom) { > > > > > > > > date.setAttribute("class","date"); > > > > > > > > date.appendChild(date_text); > > > > > > > > date.appendChild(date_line); > > > > > > > > isBottom = true; > > > > > > > > } else { > > > > > > > > date.setAttribute("class","date_bottom"); > > > > > > > > date.appendChild(date_line); > > > > > > > > var date_bottom_text = document.createElement > > ("div"); > > > > > > > > > date_bottom_text.setAttribute("class","date_element_text"); > > > > > > > > date_bottom_text.appendChild(date_text); > > > > > > > > date.appendChild(date_bottom_text); > > > > > > > > isBottom = false; > > > > > > > > } > > > > > > > > timeline.appendChild(date); > > > > > > > > } > > > > > > > > timeline.appendChild(line); > > > > > > > > timeline_content.appendChild(timeline); > > > > > > > > > var next_arrow = document.createElement("div"); > > > > > > > > next_arrow.setAttribute("id","next"); > > > > > > > > next_arrow.setAttribute("class","arrows"); > > > next_arrow.setAttribute("onclick","slide_timeline_next();"); > > > > > > > > var next_arrow_text = document.createTextNode("><br > > /><br / > > > > > > > > ><br />>"); > > > > > > > > > next_arrow.appendChild(next_arrow_text); > > > > > > > > timeline_content.appendChild(next_arrow); > > > > > > > > > var previous_arrow = document.createElement("div"); > > > > > > > > previous_arrow.setAttribute("id","previous"); > > > > > > > > previous_arrow.setAttribute("class","arrows"); > > > previous_arrow.setAttribute("onclick","slide_timeline_previous();"); > > > > > > > > var previous_arrow_text = document.createTextNode("<<br > > / > > > > > > > > ><br /><br /><"); > > > > > > > > > previous_arrow.appendChild(previous_arrow_text); > > > > > > > > timeline_content.appendChild(previous_arrow); > > > > > > > > > document.body.appendChild(timeline_content); > > > > > > > > $(''timeline'').setStyle({ > > > > > > > > width: 8 * loop_length + ''em'' > > > > > > > > }); > > > > > > > > > } > > > > > > > > > ------------------------------------~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
People! 1) please stop using top-replying to such a degree. 2) please stop QUOTING TONS OF STUFF unnecessarily! About the issue: onCreate is NOT triggered on individual elements, but only at the global level on Ajax.Responders. This is clearly stated in the docs [1]. The rationale is: you do know when you create the element: you''re doing it just now! So you can call create_loader right after creating your Ajax requester (or right before, as you prefer). [1] http://prototypejs.org/api/ajax/options -- 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 -~----------~----~----~----~------~----~------~--~---
Hi everybody! I finally have the Ajax part working! :) Now it receives the information from the XML file. The only problem I have now is the stuff created. I have it working to a degree, its just the positioning and appearance stuff isn''t working. Plus, when I open it in IE6 the onclicks don''t work and the cursor is set to the text cursor, which I have it as a pointer in the css. Heres the running file: http://the60s.andrewmadonna.com/timeline.html And heres what its supposed to look like after (except I only have one date in the server): http://the60s.andrewmadonna.com/timeline_year.html Thanks for all your help guys! --~--~---------~--~----~------------~-------~--~----~ 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 again, Now it works perfectly in Firefox, but its completely missed up in IE6. Does IE ignore CSS information on elements created with the DOM? Also the onclicks don''t work either. 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 -~----------~----~----~----~------~----~------~--~---