var divEnlaces = 'enlaces'; var divDocumentos = 'documentos'; var verMasNombre = 'verMas'; /** * Recupera los siguientes 30 enlaces. * * @param tipo * @param siguiente */ function verMas(tipo, siguiente) { $.ajax({ type: "GET", url: "enlacesEmpleo.json", data: { tipoEnlace: tipo, siguiente: siguiente }, complete: function (e, XHR, options) {}, error: function(xhr, ajaxOptions, thrownError){}, success: function(json) { mostrarEnlaces(tipo, json); }, dataType: "json", contentType: "application/x-www-form-urlencoded;charset=UTF-8" }); } /** * * @param tipo * @param json */ function mostrarEnlaces (tipo, json) { var divNombre = ''; if (tipo == '0') { divNombre = divEnlaces; } else { divNombre = divDocumentos; } if (json!=null && json.lista!=null) { for(var i=0; i < json.lista.length; i++) { var enlace = json.lista[i]; var descripcion = enlace.ruta; if (enlace.descripcion!='undefined' && enlace.descripcion!=null && enlace.descripcion!='') { descripcion = enlace.descripcion; } var a = null; if(tipo == 0){ a = $('').addClass('listado').attr('href', enlace.ruta).attr('target', '_blank').html(descripcion); }else{ a = $('').addClass('listado').attr('onClick', 'enlace("/migrar/download/documentoEmpleo.htm?idEnlace="'+enlace.idEnlace+')').attr('href', '/migrar/download/documentoEmpleo.htm?idEnlace='+enlace.idEnlace).attr('target', '_blank').html(descripcion); } var pEnlace = $('

').html(a); $('#' + divNombre).append(pEnlace); } } if (json.siguiente > 0) { $('#' + verMasNombre + divNombre).attr('href', 'javascript:verMas(' + tipo +', ' + json.siguiente + ')'); } else { $('#' + verMasNombre + divNombre).hide(); } }