0

Following is my servlet mapping:

Path: EAR/WAR/WEB-INF/web.xml

    <servlet>
    <servlet-name>GetChartDetails</servlet-name>
    <servlet-class>com.high.GetChartDetails</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>GetChartDetails</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

Following in the location of my JSP:

Path: war/Monitor/XYZ.jsp

Inside this jsp, I am trying to make ajax call by calling above servlet as follows:

$.ajax({ type: "GET", url:"http://localhost:25014/Monitor/GetChartDetails? jsonp="+chartType, dataType: 'jsonp', jsonpCallback: chartType, error: function () { alert("Error is occured"); } });

chartType is a string. I am getting the alert as "Error is occured" and servlet is not being called.

Can someone please help me with this. Thank you.

Akshaya
  • 61
  • 5
  • I am assuming the context root of your web application is `Monitor`? You are mapping your servlet to `/` so try `http://localhost:25014/Monitor/?jsonp="+chartType` instead – DanielBarbarian Mar 22 '17 at 12:17
  • Issue got resolved. I changed the servlet mapping. Thanks. – Akshaya Mar 23 '17 at 10:17

1 Answers1

0

Issue got resolved by changing the servlet mapping.

Akshaya
  • 61
  • 5