java - AJAX Call not Getting to Spring MVC Controller -


I am trying to make a simple AJAX call in my spring MVC project but I'm in trouble. I am requesting my AJAX by sending a string type argument and I want to get an ArrayList back type. I have read many tutorials at the moment and do not understand what is wrong with my AJAX / controller configuration. I am using ResponseBody annotation while trying to return to see my essential results. In this controller I am not returning the update object to an update mode, but it will not make any difference because the page does not need to be refreshed because I am using AJAX. Below is my AJAX call and controller code. I really appreciate it if someone can point out to me what I'm doing wrong.

  function getdays () {var month selected / $ ("# monthselect option: selected") text (); Warning (monthSelected); $ .ajax ({url: '$ {pagecontonte.request.contextpath} / ajaxdays', data: month selected, success: work (data) {$ ('select # days') .html (data); alert );}});  

} Here is my controller class:

  Public Class Workstation Controller for @Controller @ session {@RequestMapping (value = "/ ajaxdays", Method = RequestMethod GET) Public @ResponseBody ArrayList & lt; String & gt; Meetings (HTTPSArlate Request) {Array List & Lt; String & gt; RetList = new array list & lt; & Gt; (); RetList = this.getList (); Return retist;   

You have the following errors

  1. Wrong Url

    change url: 'ajaxdays.html' ' to $ {pageContext.request.contextPath} / ajaxdays

    < Oll>
  2. No parameters were passed

You are not sending any data to the server side, therefore data: there is no need to select the month Is


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -