我使用API和发送AJAX请求相当新。 如何使用他们的API将图像从我的网站上传到Imgur?如何检索网址?
<!-- HTML form to submit the file -->
<form onsubmit="UploadToImgur()" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="file" id="file">
<input type="submit" value="Upload" name="submit">
</form>
&#13;
var imgfile = $("#file").val();
$.ajax({
url: "https://api.imgur.com/3/upload",
type: "POST",
datatype: "json",
headers: { "Authorization": "Client-ID ** CENSORED ** "},
data: {image: imgfile},
success: {},
error: {},
});
提前感谢您的帮助!