How to receive AJAX type post with PHP -


i have got 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 jquery

$("body").delegate('.messageinp','keydown',function(e) {     if (e.which==13 ) {         $(".mesform").submit();     } });      

that's how submit 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 not know how receive ajax call php

in order form elements show in request array, such $_post need name attributes (name="<something>"). example:

<form enctype="multipart/form-data" class="mesform">     <textarea name="description" maxlength="400" placeholder="your message" class="messageinp"></textarea>     <div class="attach">     <input name="chatfil" type="file" id="chatfil" accept="image/*">     <label for="chatfil">         <img src="../img/camera.png" class="addphc">     </label> </form> 

plus stated, <textarea> not use type.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -