Message from JavaScript discussions

July 2017

— 3 lines vs 100

— 

Pretty much an anxious angry mess by the time I realized I didn't have enough time, threw my computer mouse

— What the fuck

— Was it an interview thing?

— Unsure what "word wrap" means

— 

onclick="bukapaket(' + el.id + ',' + el.nama + ')"

anyone know why this is wrong?

— Is el a global?

— Wait, gonna post my full function

— 

function loadproduk(){

    $.ajax({

    type: "GET",

  url: 'http://localhost/program/public/getjson/produk',

    dataType: "JSON",

    timeout: 10000,

    

    cache: false,

    success: function(result){

        var page = event.target;

        $.each(result[0], function(index, el){

            var nama = el.nama;

            $('#datalist').append('<ons-list-item modifier="chevron" tappable ripple class="tombolmenu" onclick="bukapaket(' + el.id + ',' + el.nama + ')"><p>'+ el.nama +'</p></ons-list-item>');

            $('#prosesloadingproduk').hide();

            console.log(el.nama);

            console.log(el.id);

        });

    },

        error: function(xhr, textStatus, thrownError) {

            $('#prosesloadingproduk').hide();

            $('#dialogerror').show();

            $("#pesanerror1").html("Terjadi Masalah, Silahkan Periksa Kembali Koneksi Internet Anda.");

            $("#pesanerror2").html(xhr.error);

            $("#pesanerror3").html("");

            console.log("error,",xhr.error);

        }

    });

};

Message permanent page

— This is TRGWII

— Christ

— Don't use onclick