How I can upload images and all element with one AJAX? I would to upload images and send filename to database.... All element working fine, but I get nothing value in the images row.
here my AJAX CODE :
$(document).ready(function() {
$("#FormSubmit").click(function (e) {
e.preventDefault();
if($("#contentText").val()==="")
{
alert("Please enter some text!");
return false;
}
var myData = $("#postA").serialize();
jQuery.ajax({
type: "POST",
url: "response.php",
data:myData,
success:function(response){
$(response).hide().prependTo("#responds").fadeIn("slow");
document.getElementById("postA").reset();
},
error:function (xhr, ajaxOptions, thrownError){
alert(thrownError);
}
});
});
and here my form code :
<form id="postA">
<textarea name="content_txt" id="contentText" ></textarea>
<input type="text" name="id_userto" />
<input type="text" name="thpost" />
<input type="file" name="thpostimg" />
<input type="text" name="thpostvid" />
<input type="text" name="thpostmsc" />
<input type="text" name="thpostlic" />
<input type="hidden" name="content4txt" value="TRUE" />
<button id="FormSubmit">Share</button>
</form>