i want to send a file from one server (website A) to another one (website B).i am using an api to achieve this.my api post file works very well and it able to upload the file.i want to use a json post request to send the file to website B.i have integrated the jquery code at system A where it should be called after the file has been uploaded in server A but the call does not work and the function doesn't execute.i have done some research and still i haven't found an answer on how to call the upload function that will upload the file in system B.should i make a new function or should add it to the upload function that uploads in system A.i want to achieve this after the function uploads the image in system A another one uploads it to system B.i have tried this but it doesnt respond.
// Sending AJAX request and upload file
async function uploadData(formdata) {
$.ajax({
url: '{{route('product.savePicture')}}',
type: 'post',
data: formdata,
contentType: false,
processData: false,
dataType: 'json',
success: function (response) {
addThumbnail(response);
}
});
// push file to system b
var form = new Formdata();
form.append("file", fileInput.files[0], $filename);
form.append("systemid",$product_details->systemid);
form.append("id",$product_details->id);
var settings = {
"url": "http://systemb/api/push_h2image",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "multipart/form-data;boundary=<calculated when request is sent>"
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});