KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the great job of having to finish off a job originally given to a contractor but was never completed. Not a problem however I've now been told that the system must support Firefox 3.6! Not great but not something I would lose sleep over until now! The system has a Ajax function that uses the FormData object and then uploads a document (usually a PDF). I've ran this through Firefox 3.6 and I get the following "FormData is not defined" var formData = new FormData($('form')[0]); That's fine as I can see that this object isn't supported, I just need to use a different method or means of collection... I used this: var formData = Components.classes["@mozilla.org/files/formdata;1"] .createInstance(Components.interfaces.nsIDOMFormData); However this gave me the following error! Permission denied for http://10.29.100.23:8080 to get property XPCComponents.classes I was unsure why this was... is the path " @mozilla.org/files/formdata;1 " incorrect? I did more research and was getting nowhere! So I then thought about serializing the form changed the following to... var formData = {}; $.each($('form')[0].serializeArray(), function(_, kv) { if (formData.hasOwnProperty(kv.name)) { formData[kv.name] = $.makeArray(formData[kv.name]); formData[kv.name].push(kv.value); }else { formData[kv.name] = kv.value; } }); although this didn#t error the Ajax function wasn't uploading (I presume it wasn't recognizing or finding the file or it was just collecting a string for the file value). Does anyone have any recommendations on an alternative for FormData in older browsers, especially Firefox 3.6 - that's the only old browser I have to support. ** update **
Tags (comma-separated)
Save Edits
Cancel