I have following code in my send.js
:
function send_upload_file(){
var FD = new FormData();
FD.append( $this.name, $this.value);
$.ajax({
url: 'upload',
type: 'POST',
processData: false,
contentType: false,
cache: false,
data: FD,
success: function (data) {
console.log('ok');
},
error: function () {
alert("ERROR in upload");
}
});
}
Can I put two links inside url:
? (e.g url: 'upload, send')
No. If you wanna send two AJAX requests, you need to do it twice. But the shorthand for this would be:
The above works asynchronously. If you want to do it synchronously, you need to do: