post ajax data to spring controller
<p>I am a newbie to AJAX and i am trying to configure a simple method to post data into the controller using ajax only since i'm not sufficient in <code>JSON</code>
,<code>lambda expressions</code> other than <code>Java</code> can someone tell me what is the mistake i'm doing that this ajax method is not working?   </p>

<p><strong>Controller</strong></p>

<pre><code>@RequestMapping(value = "/test", method = RequestMethod.GET)
public String addCart(int val1, int val2) {
    System.out.println("+++++++++++++++++++++++++++++" + val1);
    System.out.println("+++++++++++++++++++++++++++++" + val2);

    return "redirect:/viewResult";

}
</code></pre>

<p><strong>Ajax/Script</strong></p>

<pre><code> $(document).on('change', '._someDropDown', function (e) {
       var x = this.options[e.target.selectedIndex].text;
       var y = $(this).data('idtest');
       alert(x);
       alert(y);

   $.ajax(
        {
         url: "/HRS/test",
         data: {val1: x, val2: y},
         method: 'POST'
         });
  });
</code></pre>

<p>note that these alerts(x and y values) are shown correctly.I just want to send them to my controller.Please any suggestions?</p>