I have the attached class that I''m writing. The problem that I''m running into is that I can not access the options from the createArray function which get called after the ajax request gets done. I want to move the values of the xml file to an array and story it in the options variable. Can someone explain what I''m doing wrong? var LeaderInfo = Class.create(); LeaderInfo.prototype = { initialize: function() { var options = Object.extend({ sdEventInfo: [], sdLeaderInfo: [], sdMiscInfo: [] }); this.options = options; this.loadXML(); }, loadXML: function() { new Ajax.Request(''../../xml_files/session_data.xml'', {method:''get'',parameters:''time=''+Math.random()*4,onComplete: this.createArray}) }, createArray: function(response) { xmlDoc = response.responseXML; var ei xmlDoc.getElementsByTagName(''event_info''); for(j=0;j<ei[0].childNodes.length;j++) { if (ei[0].childNodes[j].nodeType !1) continue try { //this.sdEventInfo[ei[0].childNodes[j].nodeName] ei[0].childNodes[j].firstChild.nodeValue; //this.options.sdEventInfo.push(ei[0].childNodes[j].firstChild.nodeValue ); var theData ei[0].childNodes[j].firstChild.nodeValue; } catch (e) { var theData = " "; $(''debug'').innerHTML +e+"<br />"; //this.sdEventInfo.push(" "); } alert(this.options.sdEventInfo.length); } }, getEventInfo: function(field) { /*alert(this.sdEventInfo.length); return this.sdEventInfo[field];*/ return this.options.sdEventInfo.length; } } var leaderinfo = new LeaderInfo(); <http://zend.com/zce.php?c=ZEND002524&r=212822110> Jon Whitcraft Indianapolis Motor Speedway jwhitcraft-1LwPDYEpVrH2eFz/2MeuCQ@public.gmane.org Phone: (317) 492-8623 :: Fax: (317) 492-6419 ******************** ******************** This E-mail (and attachments) may contain confidential/privileged information intended only for the named addressee(s). If you are not an intended recipient, do not read, copy, disseminate or take any action based on the content of this E-mail. Please notify the sender by reply E-mail and erase this E-mail from your system. Your assistance is appreciated. E-mail transmission may not be secure or error-free. The company is not responsible for any loss/damage arising from any virus transmitted. ******************** ******************** _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
onComplete: this.createArray.bindAsEventListener(this) ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Whitcraft, Jon Sent: Tuesday, February 07, 2006 12:30 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Question about Classes. I have the attached class that I''m writing. The problem that I''m running into is that I can not access the options from the createArray function which get called after the ajax request gets done. I want to move the values of the xml file to an array and story it in the options variable. Can someone explain what I''m doing wrong? var LeaderInfo = Class.create(); LeaderInfo.prototype = { initialize: function() { var options = Object.extend({ sdEventInfo: [], sdLeaderInfo: [], sdMiscInfo: [] }); this.options = options; this.loadXML(); }, loadXML: function() { new Ajax.Request(''../../xml_files/session_data.xml'', {method:''get'',parameters:''time=''+Math.random()*4,onComplete: this.createArray}) }, createArray: function(response) { xmlDoc = response.responseXML; var ei xmlDoc.getElementsByTagName(''event_info''); for(j=0;j<ei[0].childNodes.length;j++) { if (ei[0].childNodes[j].nodeType !1) continue try { //this.sdEventInfo[ei[0].childNodes[j].nodeName] ei[0].childNodes[j].firstChild.nodeValue; //this.options.sdEventInfo.push(ei[0].childNodes[j].firstChild.nodeValue ); var theData ei[0].childNodes[j].firstChild.nodeValue; } catch (e) { var theData = " "; $(''debug'').innerHTML +e+"<br />"; //this.sdEventInfo.push(" "); } alert(this.options.sdEventInfo.length); } }, getEventInfo: function(field) { /*alert(this.sdEventInfo.length); return this.sdEventInfo[field];*/ return this.options.sdEventInfo.length; } } var leaderinfo = new LeaderInfo(); <http://zend.com/zce.php?c=ZEND002524&r=212822110> Jon Whitcraft Indianapolis Motor Speedway jwhitcraft-1LwPDYEpVrH2eFz/2MeuCQ@public.gmane.org Phone: (317) 492-8623 :: Fax: (317) 492-6419 ******************** ******************** This E-mail (and attachments) may contain confidential/privileged information intended only for the named addressee(s). If you are not an intended recipient, do not read, copy, disseminate or take any action based on the content of this E-mail. Please notify the sender by reply E-mail and erase this E-mail from your system. Your assistance is appreciated. E-mail transmission may not be secure or error-free. The company is not responsible for any loss/damage arising from any virus transmitted. ******************** ******************** _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Thanks Greg, I just figured that out after looking at the auto complete class. <http://zend.com/zce.php?c=ZEND002524&r=212822110> Jon Whitcraft Indianapolis Motor Speedway jwhitcraft-1LwPDYEpVrH2eFz/2MeuCQ@public.gmane.org Phone: (317) 492-8623 :: Fax: (317) 492-6419 ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Gregory Hill Sent: Tuesday, February 07, 2006 2:41 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Question about Classes. onComplete: this.createArray.bindAsEventListener(this) ________________________________ From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Whitcraft, Jon Sent: Tuesday, February 07, 2006 12:30 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Question about Classes. I have the attached class that I''m writing. The problem that I''m running into is that I can not access the options from the createArray function which get called after the ajax request gets done. I want to move the values of the xml file to an array and story it in the options variable. Can someone explain what I''m doing wrong? var LeaderInfo = Class.create(); LeaderInfo.prototype = { initialize: function() { var options = Object.extend({ sdEventInfo: [], sdLeaderInfo: [], sdMiscInfo: [] }); this.options = options; this.loadXML(); }, loadXML: function() { new Ajax.Request(''../../xml_files/session_data.xml'', {method:''get'',parameters:''time=''+Math.random()*4,onComplete: this.createArray}) }, createArray: function(response) { xmlDoc = response.responseXML; var ei xmlDoc.getElementsByTagName(''event_info''); for(j=0;j<ei[0].childNodes.length;j++) { if (ei[0].childNodes[j].nodeType !1) continue try { //this.sdEventInfo[ei[0].childNodes[j].nodeName] ei[0].childNodes[j].firstChild.nodeValue; //this.options.sdEventInfo.push(ei[0].childNodes[j].firstChild.nodeValue ); var theData ei[0].childNodes[j].firstChild.nodeValue; } catch (e) { var theData = " "; $(''debug'').innerHTML +e+"<br />"; //this.sdEventInfo.push(" "); } alert(this.options.sdEventInfo.length); } }, getEventInfo: function(field) { /*alert(this.sdEventInfo.length); return this.sdEventInfo[field];*/ return this.options.sdEventInfo.length; } } var leaderinfo = new LeaderInfo(); <http://zend.com/zce.php?c=ZEND002524&r=212822110> Jon Whitcraft Indianapolis Motor Speedway jwhitcraft-1LwPDYEpVrH2eFz/2MeuCQ@public.gmane.org Phone: (317) 492-8623 :: Fax: (317) 492-6419 ******************** ******************** This E-mail (and attachments) may contain confidential/privileged information intended only for the named addressee(s). If you are not an intended recipient, do not read, copy, disseminate or take any action based on the content of this E-mail. Please notify the sender by reply E-mail and erase this E-mail from your system. Your assistance is appreciated. E-mail transmission may not be secure or error-free. The company is not responsible for any loss/damage arising from any virus transmitted. ******************** ******************** _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Possibly Parallel Threads
- prototype ajax + xml response
- good javascript xml parser
- Updated the xml code to be more object-oriented
- Trouble supressing ASAN reported leaks
- 5 commits - libswfdec/swfdec_html_parser.c libswfdec/swfdec_text_field.c libswfdec/swfdec_text_field_movie_as.c libswfdec/swfdec_text_field_movie.c libswfdec/swfdec_xml.c test/trace