✏️ 正在编辑: carregar-mais.js
路径:
/srv/systems_dir/yuppiecred/public/scripts/plugins/carregar-mais.js
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
(function ( $ ) { $.fn.carregarMais = function(options) { if (!options.url) { return this; } options.elementName = this.selector.slice(1,this.selector.length); options.elementNameButton = 'bnt-' + options.elementName; if (!options.botaoNome) { options.botaoNome = 'Carregar Mais'; } if (!options.botaoIcone) { options.botaoIcone = baseUrl + '/assets/icon_add.png">'; } if (!options.limite) { options.limite = 50; } var htmlBotao = '<div style="width: 100%; text-align: center;padding-top: 10px;">' + '<button id="' + options.elementNameButton + '">' + '<img style="float: left;" src="' + options.botaoIcone + '<span style="float: left;">' + options.botaoNome + '</span>' + '</button>' + '</div>'; var ultimoId = function() { return $("#"+options.elementName) .find('tbody tr:last') .find('.telefone-id') .val(); }; var parametrosParaAjax = function() { if (options.parametros) { options.parametros.ultimo_id = ultimoId(); options.parametros.limite = options.limite; } return options.parametros; }; this.after(htmlBotao); $(document).on('click', '#'+options.elementNameButton, function() { $.ajax({ url: options.url, method: 'post', data: parametrosParaAjax(), success: function(result) { if (result == 0) { alert('Fim da listagem'); return false; } $('#'+options.elementName + ' tbody').append(result); return false; } }) }); return this; }; }( jQuery ));
💾 保存文件
← 返回文件管理器