Image placeholder

Fajax – 用于Ajaxifying Forms的轻量级jQuery插件

Image placeholder
F2EX 2016-12-31

Fajax 是一个用于 Ajaxifying Forms 和文件支持的轻量级 jQuery 插件,它是 $.ajax 函数的包装器。压缩后大小只有345bytes。

用法

只需像往常一样写你的表单标记:

<form action="http://example.com/action.php" method="post">
    <input type="text" name="user">
    <input type="email" name="email">
    <input type="submit">
</form>

然后调用插件:

$('form').fajax({
    success: function(){
        alert('The form was successfully sent');
    },
});

Fajax有所有 $.ajax 参数,除了url,type,data,processData和contentType。你应该在你的标记中设置url,类型和数据。


2016-12-31