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

116
Views
No se pueden obtener datos en la página usando Ajax con arranque de primavera

No puedo obtener los datos en la página usando AJAX con Spring Boot. Cuando pruebo la URL en el cartero, obtiene todos los valores de la base de datos, pero cuando escribo la misma URL en el navegador, solo muestra []. He adjuntado mi código aquí, por favor ayúdenme a encontrar una solución para este problema. La lista de datos se toma correctamente.

Controlador

 @RequestMapping(value = "/getEasyQuestionsBySkill/{primarySkill}", method = RequestMethod.GET, produces = { MimeTypeUtils.APPLICATION_JSON_VALUE }) public ResponseEntity<List<EasyQuestions>> getAllEasyQuestions(@PathVariable String primarySkill) { try { ResponseEntity<List<EasyQuestions>> responseEntity = new ResponseEntity<List<EasyQuestions>>(easyQuestionsService.getEasyQuestionsBySkill(primarySkill), HttpStatus.OK); return responseEntity; } catch (Exception e) { return new ResponseEntity<List<EasyQuestions>> (HttpStatus.BAD_REQUEST); } }

Hoja de tomillo - Javascript

 $("#skillSubmitBtnId").on("click",function() { var skill_name = $(".skillCls").val(); if(skill_name == ""){ alert("Select a Primary Skill"); }else { $.ajax({ type: 'GET', url: '/getEasyQuestionsBySkill/{'+skill_name+'}', dataType: 'json', success: function(result) { var str = ''; for(var i=0; i<result.length; i++) { str += '<br/> Question :' +result[i].question; str += '<br/> Primary Skill :' +result[i].primarySkill; str += '<br/> Secondary Skill :' +result[i].secondarySkill; str += '<br/>'; } $("#contentDivId").html(str); } }); $("#errorDivId").hide(); $("#javaTableDivId").show(); } });
about 4 years ago · Santiago Gelvez
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!