Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. success :   function(response){
  2.                         var json = $.parseJSON(response);
  3.                         var html = '';
  4.                         html += '<table class="table table-bordered table-striped">\n';
  5.                             html += '<tr>\n';
  6.                                 html += '<th class="text-center">Atleta 1</th>\n';
  7.                                 html += '<th class="text-center">Atleta 2</th>\n';
  8.                                 html += '<th class="text-center">Data e Hora</th>\n';
  9.                                 html += '<th class="text-center">Pts. Atl. 1</th>\n';
  10.                                 html += '<th class="text-center">Pts. Atl. 2</th>\n';
  11.                                 html += '<th class="text-center">Parciais</th>\n';
  12.                                 html += '<th class="text-center">Confirmado</th>\n';
  13.                             html += '</tr>\n';
  14.                             if(json.length > 0){
  15.                                 var total = Math.ceil(json.length);
  16.                                 for(var i = 0; i < total; i++)
  17.                                 {
  18.                                     html += '<tr>\n';
  19.                                         html += '<td class="text-center">\n';
  20.                                             html += '<select name="jogo_esq" class="form-control jogo-esq">\n';
  21.                                                 for(var a = 0; a < json.length; a++)
  22.                                                 {
  23.                                                     if(json[a].atl_ID_1 == json[i].atl_ID_1){
  24.                                                         html += '<option value="' + json[a].atl_ID_1 + '" selected="selected">' + json[a].atl_nome_1 + '</option>'
  25.                                                     } else {
  26.                                                         html += '<option value="' + json[a].atl_ID_1 + '">' + json[a].atl_nome_1 + '</option>';
  27.                                                     }
  28.                                                 }
  29.                                             html += '</select>';
  30.                                         html += '</td>\n';
  31.                                         html += '<td class="text-center">\n';
  32.                                             html += '<select name="jogo_dir" class="form-control jogo-dir">\n';
  33.                                                 for(var b = 0; b < json.length; b++)
  34.                                                 {
  35.                                                     if(json[b].atl_ID_2 == json[i].atl_ID_2){
  36.                                                         html += '<option value="' + json[b].atl_ID_2 + '" selected="selected">' + json[b].atl_nome_2 + '</option>';
  37.                                                     } else {
  38.                                                         html += '<option value="' + json[b].atl_ID_2 + '">' + json[b].atl_nome_2 + '</option>';
  39.                                                     }
  40.                                                 }
  41.                                             html += '</select>';
  42.                                         html += '</td>\n';
  43.                                         html += '<td class="text-center">\n';
  44.                                             html += '<input name="jogo_data[]" type="text" class="text-center jogo-data form-control" placeholder="DD/MM/YYYY HH:MM"/>\n';
  45.                                         html += '</td>\n';
  46.                                         html += '<td class="text-center">\n';
  47.                                             html += '<input name="jogo_pts_esq[]" type="text" class="text-center jogo-pts-esq form-control" />\n';
  48.                                         html += '</td>\n';
  49.                                         html += '<td class="text-center">\n';
  50.                                             html += '<input name="jogo_pts_dir[]" type="text" class="text-center jogo-pts-dir form-control" />\n';
  51.                                         html += '</td>\n';
  52.                                         html += '<td class="text-center">\n';
  53.                                             html += '<input name="jogo_parciais[]" type="text" class="text-center jogo-parciais form-control" placeholder="1 X 2 | 2 X 1 | 4 X 2" />\n';
  54.                                         html += '</td>\n';
  55.                                         html += '<td class="text-center">\n';
  56.                                             html += '<select name="jogo_confirma" class="form-control">\n';
  57.                                                 html += '<option value="Não">Não</option>\n';
  58.                                                 html += '<option value="Sim">Sim</option>\n';
  59.                                             html += '</select>\n';
  60.                                         html += '</td>\n';
  61.                                     html += '</tr>\n';
  62.                                 }
  63.                             } else {
  64.                                 html += '<tr>\n';
  65.                                     html += '<td class="text-center" colspan="8">Esta categoria não possui nenhum atleta até o momento.</td>\n';
  66.                                 html += '</tr>\n';
  67.                             }
  68.                         html += '</table>';
  69.                         html += '<input type="hidden" name="jogo_rodada" value="' + Categoria + '" />';
  70.                        
  71.                         $('.loading-data').fadeOut('fast', function(){
  72.                             $('#form-salvar-jogos').fadeIn('fast', function(){
  73.                                 $('#ajx-games').append(html);
  74.                                 console.log(response);
  75.                             });
  76.                         });
  77.                     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement