简体   繁体   中英

Why i am getting 406 not accepatble at client side status by the server and even my spring controller is not calling?

Here is my code ajax get request code

$("#tabsss2").click(function tab1()
{
    $.ajax({
            type: "get",
            traditional: true,
            dataType: 'json',
            url: "DataGridServlet.htm",
            cache: false,

            success: function (response) {
                         alert(response);
                      }

           });

           console.log("hii");
});

and controller code is what i have written as controller

@RequestMapping(value="/DataGridServlet.htm", method = RequestMethod.GET,produces="application/json")
    public @ResponseBody JSONObject getReturnData()
    {
       System.out.println("control came into conroller");
       JSONObject dataObject=new JSONObject();
       dataObject=jqTabsGridDataDao.getTabsData();
       System.out.println("controller data:"+dataObject);
       return dataObject;
    }   

so any one can help?

add the following header in ajax request

headers: {          
    Accept: "application/json" 
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM