upload image without using form submit in php with ajax code example
Example: Upload image via ajax (jquery)
var form = new FormData();
form.append('varName','data');
$.ajax({
type:'POST',
url: $(this).attr('action'),
data:formData,
cache:false,
contentType: false,
processData: false,
success:function(data){
//function here
},
error: function(data){
//function here
}
});