T.J., Thanks for the rapid response!
In this case, I'm just requesting a static, plain-text file. As such, it contains no headers as an HTML response would. Additionally, the text in the response is never displayed by the browser; it's only parsed into an array of JSON objects. Since this is a static file, should I just manually add a header to the file? If so, do you know the syntax for the header? Thanks again! On Apr 13, 9:46 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote: > Hey Mikey, > > I think the issue isn't the request headers, but rather the response > headers. Make sure your server is sending back the correct content > type. Firefox will take the server's word for it in terms of what is > coming back (HTML, XML, JSON, etc.),. For what you're doing, you > probably want the server to be sending back the type "text/plain". > How you do that depends on what kind of server software you're using. > > HTH, > -- > T.J. Crowder > tj / crowder software / com > Independent Software Engineer, consulting services available > > On Apr 13, 4:33 pm, MikeyLikesIt <etov...@gmail.com> wrote: > > > Howdy! > > > I'm attempting to use the Ajax.Request object to grab a text file for > > parsing. In this context, the file is a *.properties file that > > contains application constants that are parsed into properties and > > associated values. > > > It works great, except for one, small problem with Mozilla. Whenever > > the file is read, Mozilla generates a "not well formed" error, because > > it is expecting a well-formed HTML response. This is probably working > > as intended, but is there a setting in the Ajax.Request object that > > will allow the browser to expect a plain-text response and not a well- > > formed HTML response? I've played around with the requestHeaders > > option a bit, but that hasn't helped, unless I'm not getting it (which > > is quite possible). > > > A snippet from my object is below, for reference. Thanks in advance > > for the help! > > > ================================================================= > > > , getResponse: function() { > > > var reader = this; > > new Ajax.Request( > > reader.FILE_PATH > > , { > > method: 'get' > > , onSuccess: function(transport) { > > reader.parseResponse(transport, > > reader.properties); } > > , onFailure: function() { alert('There was > > an error processing > > this request.'); } > > }); > > } > > > , parseResponse: function(transport, propertiesArray) { > > > var rawResponse = transport.responseText.split('\n'); > > var reader = this; > > > for(var i = 0; i < rawResponse.length; i++) { > > var line = rawResponse[i]; > > var index = line.indexOf('='); > > if(index > -1) { > > var property = { > > name: line.substring(0, index) > > , value: line.substring(index + 1, > > line.length) > > }; > > propertiesArray.push(property); > > } > > } > > } > > > ================================================================= --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---