title: Jquery does not work when I request to rest service (spring boot)
body: <p>I'm working on a spring boot rest api and I want to take information from rest api to a html page. I tried this using jquery but I could not take data. </p>
  
  <p>Here is my Rest Controller</p>
  
  <pre><code>package tr.kasim.Controller;
  
  import java.sql.Date;
  import java.util.List;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.http.HttpStatus;
  import org.springframework.http.ResponseEntity;
  import org.springframework.web.bind.annotation.CrossOrigin;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.web.bind.annotation.RestController;
  import tr.kasim.Service.PersonelService;
  import tr.kasim.Service.PtsGirisCikisService;
  import tr.kasim.Model.Personel;
  import tr.kasim.Model.PtsGiriscikis;
  
  @CrossOrigin("*")
  @RestController
  public class STRestController {
  
  @Autowired
  public PersonelService personelService;
  
  @Autowired
  public PtsGirisCikisService ptsGirisCikisService;
  
  @GetMapping("/api/personels")
  public ResponseEntity&lt;List&lt;Personel&gt;&gt; getPersonels(){
      List&lt;Personel&gt; personels = personelService.findAll();
      return ResponseEntity.ok().body(personels);
  }
  
  @GetMapping("/api/giriscikis")
  public ResponseEntity&lt;List&lt;PtsGiriscikis&gt;&gt; getGirisCikis(){
      List&lt;PtsGiriscikis&gt; giriscikis = ptsGirisCikisService.findAll();
      return ResponseEntity.ok().body(giriscikis);
  }
  
  //@GetMapping("/api/personel")
  @RequestMapping(method=RequestMethod.GET, value="/api/personel", produces="application/json" )
  public ResponseEntity&lt;List&lt;PtsGiriscikis&gt;&gt; getPersonelByKartNoAndİseGiris(@RequestParam("kartno") String KartNo , @RequestParam("tarih") Date IseGirisTarihi){
      String errorMessage="Aranilan Personel Bulunamadi!";
  
      Personel personel = personelService.findPersonelByKartnoAndIsegiristarihi(KartNo , IseGirisTarihi);
  
      if(!personel.equals(null)) {
          List&lt;PtsGiriscikis&gt; girisCikis = ptsGirisCikisService.findByPersonelid(personel.getId());
          return ResponseEntity.ok().body(girisCikis);
      }
  
          return null;
  }
  
  }
  </code></pre>
  
  <p>Here is my Controller</p>
  
  <pre><code>package tr.kasim.Controller;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.GetMapping;
  
  @Controller
  public class STController {
  
  @GetMapping("/")
  public String goHome() {
      return "templates/index";
  }
  }
  </code></pre>
  
  <p>Here is index.html page</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Hello jQuery&lt;/title&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          function findPersonels() {
              $.ajax({
                  type:"GET",
                  url: "/api/personels",
                  contentType: "application/json"
              }).then(function(data) {
                  $('.giriscikis-id').append(data.id);
                  $('.giriscikis-ad').append(data.ad);
              });
          }
      &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div&gt;
  
          &lt;p class="giriscikis-id"&gt;The ID is &lt;/p&gt;
          &lt;p class="giriscikis-ad"&gt;The name is &lt;/p&gt;
          &lt;input type="button" id="doldur" name="doldur" value="field doldur" onclick="findPersonels();"&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>I tried many jquery + spring application examples but I still got nothing. When I tried to reach index.html I just saw my html writings, rest service information are not showing. Please correct me, thank you. </p>