Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Dudas con partes de código js

Estas en el tema de Dudas con partes de código js en el foro de Frameworks JS en Foros del Web. Hola, tengo un problemilla con un js de 7000líneas y una de las cosas que más me lían es esta. A ver si alguien entiende ...
  #1 (permalink)  
Antiguo 05/12/2014, 18:38
 
Fecha de Ingreso: mayo-2008
Mensajes: 228
Antigüedad: 15 años, 10 meses
Puntos: 2
Dudas con partes de código js

Hola, tengo un problemilla con un js de 7000líneas y una de las cosas que más me lían es esta. A ver si alguien entiende que se está haciendo exactamente ya que tengo ciertas dudas.
Según el código entiendo que el usuario tiene un formulario php, el cual por medio del js no se muy bien para que ni porque lo hace así, pero me parece que pinta un formulario muy rápido para recoger las variables, se lo envía al php y lo borra. Todo esto entiendo que lo hace tan rápido que no se ve y parece un envío normal como pudiera ser con una función ajax. Estoy en lo cierto o me he colado.

Otra pregunta que tenía era ¿ una vez que ha terminado esta parte del código el javascript sigue hasta terminar de leer el archivo entero verdad ?, es decir si no hay ningún return se lee todo el javascript entero no ?.

Código Javascript:
Ver original
  1. $(document).on('click','.editar_repaso', function(event) {
  2.     event.preventDefault();
  3.     //    console.log('click');
  4.     var file=$(this).attr("rel");
  5.     var id=$(this).attr("rel_id");
  6.  
  7.     //alert(id);
  8.  
  9.     var mat=$(this).attr("rel_mat");
  10.     var sub=$(this).attr("rel_sub");
  11.     var tpl=$(this).attr("rel_tpl");
  12.     var id_tipo_recurso=$(this).attr("id_tipo_recurso");
  13.     var id_temporal =$(this).attr("id_temporal");
  14.     var continuar_temporal =$(this).attr("continuar_temporal");
  15.     var nombre_recurso =$(this).attr("nombre_recurso");
  16.  
  17.     var tpl_edit=$(this).attr("rel_edit");
  18.     var myForm = document.createElement("form");
  19.     myForm.method="post" ;
  20.     myForm.action = "../cms/repaso.html" ;
  21.     var myInput1 = document.createElement("input") ;
  22.         myInput1.setAttribute("name", "xml_file") ;
  23.         myInput1.setAttribute("value", file);
  24.         myForm.appendChild(myInput1) ;
  25.     var myInput2 = document.createElement("input") ;
  26.         myInput2.setAttribute("name", "identificador") ;
  27.         myInput2.setAttribute("value", id);
  28.         myForm.appendChild(myInput2) ;
  29.     var myInput3 = document.createElement("input") ;
  30.         myInput3.setAttribute("name", "materia") ;
  31.         myInput3.setAttribute("value", mat);
  32.         myForm.appendChild(myInput3) ;
  33.     var myInput4 = document.createElement("input") ;
  34.         myInput4.setAttribute("name", "submateria") ;
  35.         myInput4.setAttribute("value", sub);
  36.         myForm.appendChild(myInput4) ;
  37.    var myInput5 = document.createElement("input") ;
  38.         myInput5.setAttribute("name", "plantilla") ;
  39.         myInput5.setAttribute("value", tpl);
  40.         myForm.appendChild(myInput5) ;
  41.     var myInput6 = document.createElement("input") ;
  42.         myInput6.setAttribute("name", "tpl_edit") ;
  43.         myInput6.setAttribute("value", tpl_edit);
  44.         myForm.appendChild(myInput6) ;
  45.     var myInput7 = document.createElement("input") ;
  46.         myInput7.setAttribute("name", "id_tipo_recurso") ;
  47.         myInput7.setAttribute("value", id_tipo_recurso);
  48.         myForm.appendChild(myInput7) ;
  49.     var myInput8 = document.createElement("input") ;
  50.         myInput8.setAttribute("name", "id_temporal") ;
  51.         myInput8.setAttribute("value", id_temporal);
  52.         myForm.appendChild(myInput8) ;
  53.     var myInput9 = document.createElement("input") ;
  54.         myInput9.setAttribute("name", "continuar_temporal") ;
  55.         myInput9.setAttribute("value", continuar_temporal);
  56.         myForm.appendChild(myInput9) ;
  57.     var myInput10 = document.createElement("input") ;
  58.         myInput10.setAttribute("name", "nombre_recurso") ;
  59.         myInput10.setAttribute("value", nombre_recurso);
  60.         myForm.appendChild(myInput10) ;
  61.        
  62.         if ($(this).hasClass('blank'))
  63.             myForm.target='_blank';
  64.      document.body.appendChild(myForm);
  65.     myForm.submit() ;
  66.     document.body.removeChild(myForm) ;
  67. });

Etiquetas: ajax, dudas, formulario, input, javascript, js, partes, php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:19.