I have got this straightforward HTML form
<form enctype="multipart/form-data" class="Mesform">
<textarea maxlength="400" type="text" placeholder="Your message" class="MessageInp"></textarea>
<div class="attach">
<input type="file" id="chatfil" accept="image/*">
<label for="chatfil">
<img src="../img/camera.png" class="addphc">
</label>
</form>
and this jquery
$("body").delegate('.MessageInp','keydown',function(e) {
if (e.which==13 ) {
$(".Mesform").submit();
}
});
That's how i submit my form
$(".Mesform").submit(function(){
var val=$(this).children('textarea').val();
var who=$(".headChat").text();
var formData = new FormData($(this)[0]);
alert(formData);
if (val!="") {
$.ajax({
url: '../files/ajax.php',
type: 'POST',
data:formData,
success: function (data) {
alert(data)
},
cache: false,
contentType: false,
processData: false
});
}
return false;
});
But I do not know how to receive this AJAX call with PHP