How to use JQuery post method
This question already has an answer here:
Use jQuery form plugin to AJAX submit the form with files. http://malsup.com/jquery/form/
In JS
$('#form').ajaxSubmit({
success: function(response) {
console.log(response);
}
});
in PHP
// after doing upload work etc
header('Content-type: text/json');
echo json_encode(['message' => 'Some message or param whatever']);
die();
Full docs and examples: http://malsup.com/jquery/form/#ajaxSubmit
Just submit the form!
$('form#form').submit();
For AJAX Upload read this answer
链接地址: http://www.djcxy.com/p/19608.html上一篇: 用ajax上传图片,HttpPostedFileBase为空Mvc Asp
下一篇: 如何使用JQuery post方法