These are chat archives for marquesduque/tobe

14th
Jun 2016
Murillo de Morais
@mmoraisa
Jun 14 2016 17:39
<script src="js/jquery.min.js"></script>
<script src="js/can.jquery.js"></script>
<script src="js/can.map.define.js"></script>
marquesduque
@marquesduque
Jun 14 2016 17:40
jQuery(form_selected).attr('ajax') + "?" + dataSubmit
$.ajax({
type: "POST",
url: jQuery(form_selected).attr('ajax') + "?" + dataSubmit,
dataType: 'json',
contentType: false,
processData: false,
success: function (result) {
$('#Page').val(parseInt($('#Page').val(), 10) + 49);
            $(result).each(function (index, item) {

                var template = $($("[template='" + table_id + "']").html());

                if ($('[pk_value="' + item[template.attr('pk')] + '"]').length == 0) {

                    template.attr('pk_value', item[template.attr('pk')]);

                    for (var key in item) {
                        if (item.hasOwnProperty(key)) {
                            template.find('[column="' + key + '"]').html(item[key]);
                        }
                    }
                    template.click(function () {
                        window.location = $("[template='" + table_id + "']").attr('redirect') + '/' + item[$(template).attr('pk')];
                    });
                    $('#' + table_id).append(template);
                }
            });

            $('.glyphicon-pencil').parent().css('background-color', '#008d4c');

            $('[loader="' + table_id + '"]').hide();

            if ($(result).length < 49) {
                $('[loader="' + table_id + '"] .animate').hide();
            }
            else {
                $('[loader="' + table_id + '"] .animate').show();
            }
        },
        error: function (ex, e) {
            $('[loader="' + table_id + '"]').hide();
            modal(ex.responseText);
        }
    });
Murillo de Morais
@mmoraisa
Jun 14 2016 17:44
@marquesduque gay