Hi everyone, i create a simple php script to upload images it is working nice, but now i need to do it using jquery and ajax, because as i am using only php, when i send an image it redirect the page to a white page.
well this is my simple comment system with jquery and ajax, it is simple and i tried to create some like this to image uploads but i cant use this method to image uploads,here is the code of the simple comment system, if anyone can help me with the images will be great…
HTML Code
<form id ="Forms" action="javascript:comments()" method="post">
<textarea id="comment"
placeholder="Say something"></textarea>
<input type="submit">
</form>
JavascriptCode
function comments() {
var comment = $('#comment').val();
$.ajax({
async: false,
url: 'comment.php',
type: 'POST',
dataType: 'json',
data: {
comment: $('#comment').val()
},
success:function(data) {
$("ul.#InsertThings").prepend(data);
}
});
}
Comment.php
$Comment = ($_POST['comment']);
echo json_encode(...some divs etc and $Comment inside of a div );
Well it is working great, but with photos i cant use this method, i really need some help with that because i never create anything similar and really need to do it.
I searched a lot to find some helps to my problem but cant get the best code for my problem.
Thanks community