Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

138
Vistas
jquery UI Dialog doesn't see variables defined outside of the dialog

I have TypeScript closure with function body like this where constants defined outside of the dialog(). Inside the Dialog Save button, the variables are undefined. Please help? Thanks.

    const oldAnswers: Array<IUserAnswer> = new Array<IUserAnswer>();
    const newAnswers: Array<IUserAnswer> = new Array<IUserAnswer>();
    const updatedAnswers: Array<IUserAnswer> = new Array<IUserAnswer>();
    
    $('form').map(function(){  
        //.....omitted code to change the above variables
    }
    $("#dialog").dialog({
      resizable: true,
      height: "auto",
      width: 400,
      modal: true,
      buttons: {
        "Save": function () {
          let thisUrl: string = $('#submit').attr('formAction');
          //ToDo: ajax post here
          let postBackModel: AjaxPostbackModel;
          postBackModel.NewAnswers = newAnswers;
          postBackModel.OldAnswers = oldAnswers;
          postBackModel.UpdatedAnswers = updatedAnswers;
          alert('ToDo: sending ajax postBackModel to ' + thisUrl);
        },
        Cancel: function () {
          $(this).dialog("close");
        }
      }
    });

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Thanks for your response. I solved the problem. I didn't initialize the postBackModel in the Save. Here is the correction.

let postBackModel: AjaxPostbackModel = <AjaxPostbackModel>{};

utton block.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda