title: i want to use ajax in form submission..i am getting error 405--Request method 'POST' not supported
body: <p>please let me know what kind of changes i need to do in my following code.
  here i am inserting data into database,also let me know about suitable JQuery script.
  It works fine without the ajax part in the .jsp below. But when I add the jquery ajax part in the jsp, it does not work
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>here is my controller
  @Controller
  public class EmployeeController {
  
    @Autowired
    EmpDao dao;
  
    @RequestMapping(value = "/index", method = RequestMethod.GET)
    public ModelAndView index() {
      return new ModelAndView("index", "command", new Employee());
    }
    @RequestMapping(value = "/addEmployee", method = RequestMethod.POST)
    public String addEmployee(@ModelAttribute("SpringWeb") Employee e, ModelMap model) {
      dao.saveEmployee(e);
      model.addAttribute("message", "Successfully Inserted....");
      return "index";
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>here is my form format
  
  &lt;form&gt;
    &lt;table&gt;
      &lt;tr&gt;
        &lt;td&gt;Roll:&lt;/td&gt;
        &lt;td&gt;&lt;input type="text" name="roll" id="roll"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Name:&lt;/td&gt;
        &lt;td&gt;&lt;input type="text" name="name" id="name"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Address:&lt;/td&gt;
        &lt;td&gt;&lt;input type="text" name="address" id="address"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td&gt;&lt;input type="submit" value="submit" onclick="return doAjaxPost()"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td colspan="2"&gt;
          &lt;div id="info" style="color: green;"&gt;&lt;/div&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>