Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
use el índice como parte de los datos de retorno de jQuery Ajax

Necesito usar el índice de un bucle for para verificar los valores en 10 columnas QUESTION_1_ANSWER, QUESTION_2_ANSWER, QUESTION_3_ANSWER ... etc.Return from jQuery Ajax.

Devolver objeto resultados de la encuesta: {pregunta_1_Respuesta: 'Otro', pregunta_1_Otra_Respuesta: 'Naples Florida', pregunta_2_Respuesta: '', pregunta_2_Otra_Respuesta: '', pregunta_3_Respuesta: '', …}

Intenté crear una variable, sin embargo, no funciona. ¿Alguna idea?

 ({ type: 'POST', url: 'getEmployeeSurveyResults.php', dataType: 'json', data: {surveyID: surveyID, sessionEmployeeNumber: sessionEmployeeNumber, }, cache: false, success: function (data) { $.each(data, function (i, surveyResults) { for (i = 1; i < 11 ; i++) { var surveyResultsQuestionAnswer='surveyResults.question_'+i+'_Answer' console.log( 'surveyResultsQuestionAnswer: ' + surveyResultsQuestionAnswer ); if(surveyResultsQuestionAnswer !==''){ Do something .... } } }); }, error: function(jqXHR, textStatus, errorThrown) { alert('Error: ' + textStatus + ' ' + errorThrown) } }); //* End - $.ajax
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!