开发者

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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜