我不知道如何命名它,但我会尝试描述。
$(document).on('click','.swaction',function(event){
var pdfId = $(this).closest('tr').find('td:first').html(); // Example: 44!F=%7214
var type = $(this).closest('tr').data('type');
var tableId = $(this).closest('table').attr('id');
var currentElement = this;
event.preventDefault();
if( $(currentElement).data('action') === 'get' )
{
window.location.href = "/Printbox.php/ct_form_procesar_escaneos/pdf/get/" + type + "/" + pdfId;
}
if( $(currentElement).data('action') === 'rename' )
{
$(currentElement).closest('tr').find('td:first').html(
'<input id="newPdfName-'+pdfId+'" type="text" name="newPdfName" />'+
'<select id="newPdfType-'+pdfId+'" type="text" name="newPdfType">'+
'<option selected="selected" disabled="disabled" value="">Tipo de Documento</option>'+
'<option value="cp">CP</option>'+
'<option value="tb">TB</option>'+
'</select>');
$('#newPdfName-'+pdfId).val(pdfId); // THIS doesn't work. Field is empty.
$.procesar_escaneos.linksHtml = $(currentElement).parent().html();
$(currentElement).parent().html('<a class="swaction" data-action="save" href="#">Guardar</a> | '
+ '<a class="swaction" data-action="cancel" href="#">Cancelar</a>'); // This line doesn't seem to execute, the buttons/links are not replaced.
}
这适用于数字和字母,但是当使用 , 等pdfId
取值时(
,$
网络会中断。
这些字符似乎很明显存在问题,但我不知道如何逃避它们。
例子pdfId = 44!F=%7214