js/jquery.form.js

(开头部分) 21KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
 * jQuery Form Plugin
 * version: 2.36 (07-NOV-2009)
 * @requires jQuery v1.2.6 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
;(function($) {

        jQuery.extend({
            handleError: function (s, xhr, status, e) {
                if (s.error) {
                    s.error.call(s.context || s, xhr, status, e);
                }
                if (s.global) {
                    (s.context ? jQuery(s.context) : jQuery.event).trigger("ajaxError", [xhr, s, e]);
                }
            },
            httpData: function (xhr, type, s) {
                var ct = xhr.getResponseHeader("content-type"),
        xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
        data = xml ? xhr.responseXML : xhr.responseText;
                if (xml && data.documentElement.tagName == "parsererror")
                    throw "parsererror";
                if (s && s.dataFilter)
                    data = s.dataFilter(data, type);
                if (typeof data === "string") {
                    if (type == "script")
                        jQuery.globalEval(data);
                    if (type == "json")
                        data = window["eval"]("(" + data + ")");
                }
                return data;
            }
        });

/*
	Usage Note:
	-----------
	Do not use both ajaxSubmit and ajaxForm on the same form.  These
	functions are intended to be exclusive.  Use ajaxSubmit if you want
	to bind your own submit handler to the form.  For example,

	$(document).ready(function() {
		$('#myForm').bind('submit', function() {
			$(this).ajaxSubmit({
				target: '#output'
			});
			return false; // <-- important!
		});
	});

	Use ajaxForm when you want the plugin to manage all the event binding
	for you.  For example,

	$(document).ready(function() {
		$('#myForm').ajaxForm({
后面还有 627 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。