Upload file and parameters with ajax request, pure javascript or prototypejs
I want to 开发者_Python百科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
You can still append query string parameters in a POST
Request:
xhr.open("POST", "/photos/?token=abc123");
精彩评论