$(function () { $.extend({ "format": function (source, params) { if (params === undefined) { return source; } if (arguments.length > 2 && params.constructor !== Array) { params = $.makeArray(arguments).slice(1); } if (params.constructor !== Array) { params = [params]; } $.each(params, function (i, n) { source = source.replace(new RegExp("\\{" + i + "\\}", "g"), function () { return n; }); }); return source; } }); var ajax = function (options) { options = $.extend({ test: false, div: undefined, anonymous: false, title: '未录入', url: '', method: 'get', data: '', headers: {}, success: function (result) { }, error: function (textStatus, errorThrown) { } }, options); if (options.url == '') { document.writeln("请求地址丢失!"); return; } $.ajax({ url: 'http://localhost:53233/' + options.url, data: options.data, type: options.method, headers: options.headers, success: function (result) { if (!options.test) { var $body = $('#main-content'); $body.append(''); var $section = $body.find('section').last(); $section.append($.format('