I'm passing information in AJAX to "my.php"
like this
HTML
<textarea name="Comment"></textarea>
<input id="images" type="file" name="upload_attachment[]" multiple="multiple" />
<input id="new_review" type="submit" value="Submit">
JS
jQuery('input[type=submit]').on('click', function () {
jQuery.ajax({
url: 'https://site/my.php',
data: {
post_id: 15 ,
text: jQuery("textarea[name=Comment]").val(),
images: jQuery("#images").val(),
},
success:function(data){
window.location='https://site/my.url'
}
});
});
The textarea passes well but my file input only passes a fakepath and the name of the file. How to correctly pass the file to "my.php"
in a clean and simple way ?