AJAX PUT Compatability Question

I’m trying to figure out the best way to use a PUT request to upload a file to a service. I’ve done some research on doing this with regular javascript and jquery.

I see that jQuery has support for PUT in the $.ajax method

The type of request to make (“POST” or “GET”), default is “GET”. Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.

However, I’m worried about the mention of browser compatibility. Does anyone know exactly what browsers do not support the PUT type for this $.ajax function? Its important that it work in IE6-9.

Do you have any other suggestions for performing this action with javascript?

Yes. Use POST. Modern browsers now allow you to upload something with ajax. IE doesn’t yet, but you can use a hidden iframe. There are scripts out there that will do it for you. Just search for “ajax upload”. Example: Ajax Upload; A file upload script with progress-bar, drag-and-drop.

I’ve got another question concerning PUT. The way I’m going to upload this file is from some embedded XML.

Meaning, when the page loads there will be XML embedded into the html page but in a hidden state. I will then grab that XML as a string from the HTML source. Should I perform any sort of conversion for this string? Or can I just use this string to send it as a file using PUT or POST?

Let me know if I need explain this better :blush: