title: Unable to send data from controller to javascript
body: <p>This is the jsp,</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  var a=12;
  $(document).ready(function(){
  
    $("button").click(function(){
        alert("inside click");
      $.post('test.htm',{inputNumber1: $("#inputNumber1").val()},function(data){
          alert(data);
          });
      alert("returned");
    });
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;input id="inputNumber1" type="text" size="5"&gt;
  &lt;button&gt;print&lt;/button&gt;&lt;br&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And this is the controller</p>
  
  <pre><code>package web;
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.*;
  @Controller
  public class TestController {
      @RequestMapping(value="/test.htm")
      public @ResponseBody Integer add(@RequestParam(value="inputNumber1", required=true) Integer inputNumber1,
              Model model) {
          System.out.println(inputNumber1);
          return inputNumber1;
      }
  }
  </code></pre>
  
  <p>The inputNumber1 is being sent to the controller and it is printed, but it is not being sent back to the javascript, i.e.
  <code>function(data){ alert(data) };</code>, this function is not called and so is the alert.</p>
  
  <p>I have included these two jar files apart from the usual spring jars,</p>
  
  <ol>
  <li><p>jackson-mapper-asl-1.5.2.jar</p></li>
  <li><p>spring-json-1.3.1.jar</p></li>
  </ol>
  
  <p>Why isn't that function being called? Is there something more that I have to include? Please help, I'm new to spring3 and jquery.</p>