This is my first question on this site (but the other discussions have helped me).
In the following code:
$('#selObra').change(function() {
var id_obra = $(this).val();
if (id_obra == '-1') {
//Elimino todos los renglones de la tabla
$('#tblSubcontratos tbody tr').remove();
} else {
$('#tblSubcontratos').append('<tr><td class="center" colspan="6"><img src="images/ui-anim_basic_16x16.gif" height="16" width="16" style="margin-left:auto;margin-right:auto" /></td></tr>');
//Obtengo todos los contratos de la obra seleccionada
$.ajax({
type: 'GET',
dataType: 'xml',
url: 'get_subcontratos.php',
data: 'id_obra=' + id_obra,
success: function(xml) {
$('#tblSubcontratos tbody tr').remove();
if ($(xml).find('subcontratos').attr('status') == 'OK') {
$(xml).find('subcontrato').each(function(){
var id_subcontrato = $(this).find('id_subcontrato').text();
var id_obra = $(this).find('id_obra').text();
var nombre_obra = $(this).find('nombre_obra').text();
var id_contratista = $(this).find('id_contratista').text();
var nombre_contratista = $(this).find('nombre_contratista').text();
var fecha_subcontrato = $(this).find('fecha_subcontrato').text();
var strRow = '<tr class="ui-widget-content">' +
'<td>' + id_subcontrato + '</td>' +
'<td>' + nombre_obra + '</td>' +
'<td>' + nombre_contratista + '</td>' +
'<td>' + fecha_subcontrato + '</td>' +
'<td class="center view_details"><img src="images/view.gif" /></td>' +
'<td class="center"><input type="radio" name="subcontratoSeleccionado" /></td>' +
'</tr>';
$('#tblSubcontratos tbody').append(strRow);
});
} else {
var errno = $(xml).find('errno').text();
var error = $(xml).find('error').text();
$('#message').html(errno + ' - ' + error);
$('#message').dialog('open');
}
}
});
}
$("#divSubcontratos").dialog( "option", "position", 'center' );
});
Centering the dialog is never executed... I can't see the mistake, the last line that firebug higlights is the bracket to close the else instruction... any comments will be appreciated. Thanks in advance.
Marco.
$("#divSubcontratos").dialog( "option", "position", 'center' );
, after$('#tblSubcontratos tbody tr').remove();
(Inside the ajax) this should make the magic =) PS: Welcome to Stackoverflow!! PS2: You can use the "Complete" option from ajax to call your dialog, if you want – Michel May 27 '11 at 1:14