views:

353

answers:

1

Hi,

I want to upload a file using an ajax request

var xhr = new XMLHttpRequest();

xhr.open("POST", "/photos");

xhr.overrideMimeType('text/plain; charset=x-user-defined-binary');
xhr.sendAsBinary(bin);

Works fine, but I want to post a parameter with this request ie: token=abc123

How can give a parameter to this request?

this is pure javascript, if you have the answer using prototypejs it's even better

Thanks a lot

+1  A: 

You can still append query string parameters in a POST Request:

xhr.open("POST", "/photos/?token=abc123");
Daniel Vassallo
well, works fine, thanks :o)
denisjacquemin