jQuery Ajax使用multipart / form-data提交表单元素(图像/视频) [英] jQuery Ajax Submit form elements with multipart/form-data (Image/Video)

查看:123
本文介绍了jQuery Ajax使用multipart / form-data提交表单元素(图像/视频)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $(document).ready(function(){
$(#ajax-form)。submit(function(){
$ .post(
albums.php,
$(#ajax-form) .serialize(),
function(){

}
);
return false;
});

});



我将信息发布到facebook图表api。我需要将表单文本字段和图像数据发送到远程facebook api服务器。这可能吗?谢谢!

解决方案

这是一个简单的jQuery插件,可以通过AJAX来运行文件上传。它旨在运行各种形式,但它支持文件上传。虽然它使用的是iFrames,它可以静默地运行,无需通知,每次我都可以完美无缺地运行:



http://jquery.malsup.com/form/


I am trying to submit a form via ajax using:

$(document).ready(function(){
$("#ajax-form").submit(function(){
    $.post(
        "albums.php",
        $("#ajax-form").serialize(),
        function(){

        }
    );
    return false;
});

});

I am posting data to the facebook graph api. I need to send the form text fields and image data to the remote facebook api server. Is this possible? Thanks!

解决方案

This is a simple jQuery plugin to implement and works for me for running file uploads seemingly via AJAX. It is meant to run on forms of all kinds, but it does support file uploads. Though it uses iFrames, it runs everything silently without notice, and it works flawlessly every time for me:

http://jquery.malsup.com/form/

这篇关于jQuery Ajax使用multipart / form-data提交表单元素(图像/视频)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆