JSの考え方

3069 ワード

onchange="$('#serverSubmit').trigger('click');"     #   
  $('#serverSubmit').click(function () {
        //$('#pageIndexS').val(1);
        //loadServer();
        serverTable.fnReloadAjax();     #       
        return false;
    });

onclick="javascript:showInvoke(this);"  #   

function showInvoke(obj) {         
    var tr = $(obj).parents('tr');
    $('#ip3').val(tr.attr('data-ip'));
    $('#port3').val(tr.attr('data-port'));
    $('#invokeSafVer').val(tr.attr('jsfversion').trim());
    var p = tr.children(':eq(5)').text().trim();
    if (p != "jsf" && p != "dubbo") {
        warning('      ');
        return;
    }
    getInvokeMethods();

}

function getInvokeMethods() {
    clearInvoke();
    var cmd = 'ls ' + $('#interfaceName').val();
    var interfaceName = $('#interfaceName').val();
    $.ajax({
        url: '/iface/manage/telnet/' + $('#interfaceId').val(),
        contentType: 'application/x-www-form-urlencoded',
        data: {
            interfaceName: interfaceName,
            ip: $('#ip3').val(),
            port: $('#port3').val(),
            cmd: cmd
        },
        type: 'POST',
        async: true,
        success: function (result) {
            if (result.code == 1) {
                //$('#invokeModal').modal('show');
                var m = result.content;
                m = m.replace(interfaceName, '');
                m = m.replace('jsf>', ',');
                m = m.replace('dubbo>', ',');
                m = m.replace(/\ +/g, ","); //      
                m = m.replace(/[ ]/g, ","); //    
                m = m.replace(/[\r
]/g, ","); // m = m.split(','); var mm = []; for (var i = 0; i < m.length; i++) { if (hasText(m[i])) mm.push(m[i]); } var method = document.getElementById('methodName'); method.length = 0; if (mm != null && mm.length != null) { for (var i = 0; i < mm.length; i++) { method.options.add(new Option(mm[i], mm[i])); } } getMdesc(); $('#invokeModal').modal('show'); } else { warning(' ,' + result.msg); return; } } }); function clearInvoke() { $('#result3').html(''); var method = document.getElementById('methodName'); method.length = 0; $('#methodParam1').html(''); $('#methodReturn').html(''); $('#methodName').nextAll('span').addClass('hide'); }