title: Using JQuery and ajax to connect to backend
body: <p>I am implementing a Spring Boot application and implementing a front end that will use ajax to connect to the Sprint boot back end. This is the first time, that I am using a front end and require some help. I don't know where I am going wrong. I want to pass the JSON to the backend for further processing.</p>
  
  <p>The code is located here <a href="https://github.com/rajivpjs/Customer-Inventory/tree/23_ConnectToBackEnd" rel="nofollow noreferrer">https://github.com/rajivpjs/Customer-Inventory/tree/23_ConnectToBackEnd</a> in folder customer/src/main/resources/static/js folder</p>
  
  <p>The current implementation can be debugged in the Spring boot application, but is returning a null User and Customer object.</p>
  
  <p>The ajax call is:</p>
  
  <pre><code> $.ajax({
         type: "POST",
         url: "/register/customer",
         data: JSON.stringify({ 
                "email":     $('#email').val(), 
                "pass":      $('#pass').val(), 
                "firstName": $('#firstName').val(), 
                "lastName":  $('lastName').val() }),
         dataType: "json",
         contentType : "application/json;charset=utf-8",
         success: function(data)
         {
             alert("data");
         },
         error: function(data) {
             alert(data);
         }
       });
  
       e.preventDefault();
  });
  </code></pre>
  
  <p>Can you please help?</p>
  
  <p>Thanks.</p>