(function($) { $.fn.ajaxSubmit = function(o) { if (typeof o == "function") { o = { success: o } } o = $.extend({ url: this.attr("action") || window.location.toString(), type: this.attr("method") || "GET" }, o || {}); var p = {}; $.event.trigger("form.pre.serialize", [this, o, p]); if (p.veto) { return this } var a = this.formToArray(o.semantic); if (o.data) { for (var n in o.data) { a.push({ name: n, value: o.data[n] }) } } if (o.beforeSubmit && o.beforeSubmit(a, this, o) === false) { return this } $.event.trigger("form.submit.validate", [a, this, o, p]); if (p.veto) { return this } var q = $.param(a); if (o.type.toUpperCase() == "GET") { o.url += (o.url.indexOf("?") >= 0 ? "&": "?") + q; o.data = null } else { o.data = q } var r = this, callbacks = []; if (o.resetForm) { callbacks.push(function() { r.resetForm() }) } if (o.clearForm) { callbacks.push(function() { r.clearForm() }) } if (!o.dataType && o.target) { var u = o.success || function() {}; callbacks.push(function(a) { if (this.evalScripts) { $(o.target).attr("innerHTML", a).evalScripts().each(u, arguments) } else { $(o.target).html(a).each(u, arguments) } }) } else { if (o.success) { callbacks.push(o.success) } } o.success = function(a, b) { for (var i = 0, max = callbacks.length; i < max; i++) { callbacks[i](a, b, r) } }; var v = $("input:file", this).fieldValue(); var w = false; for (var j = 0; j < v.length; j++) { if (v[j]) { w = true } } if (o.iframe || w) { if ($.browser.safari && o.closeKeepAlive) { $.get(o.closeKeepAlive, fileUpload) } else { fileUpload() } } else { $.ajax(o) } $.event.trigger("form.submit.notify", [this, o]); return this; function fileUpload() { var d = r[0]; var f = $.extend({}, $.ajaxSettings, o); var h = "jqFormIO" + $.fn.ajaxSubmit.counter++; var i = $('