title: how to call the servlet class using document.ready function
body: <p>I have created a jsp file named roleManagement.jsp : </p>
  
  <pre><code>&lt;%@page import="com.sun.org.apache.xalan.internal.xsltc.compiler.sym"%&gt;
  &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
          &lt;title&gt;Role Management&lt;/title&gt;
          &lt;script type="text/javascript" src="js/jquery-2.0.3.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;script type="text/javascript"&gt;
              $(document).ready(function() { 
                  alert("entered in trial button code");
  
                  $.ajax({
                      type: "GET",
                      url:"/jquery2xdemo/RoleManagementContoller",
                      dataType: "json",
                      success: function (data) {
                          $.each(data.aaData,function(i, obj) {
                              alert(obj.value + ":" + obj.text);
                              var div_data = "&lt;option value=" + obj.value + "&gt;" + obj.text + "&lt;/option&gt;";
                              alert(div_data);
                              $(div_data).appendTo('#ch_user1'); 
                          });  
                      }
                  });
              });
          &lt;/script&gt;
          &lt;div id="div_source1"&gt;
              &lt;select id="ch_user1" &gt;
                  &lt;option value="select"&gt;&lt;/option&gt;
              &lt;/select&gt;
          &lt;/div&gt;
          &lt;input type="button" id="id_trial" name="btn_trial" value="Trial Button.."&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In the above code ,I am trying to call my servlet on <code>$(document).ready</code> function. But I am unable to do this. I have mapped the servlet information in web.xml as :</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;description&gt;&lt;/description&gt;
      &lt;display-name&gt;RoleManagementContoller&lt;/display-name&gt;
      &lt;servlet-name&gt;RoleManagementContoller&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.programmingfree.controller.RoleManagementContoller&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;RoleManagementContoller&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/RoleManagementContoller&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>But when i run my jsp page, it is not at all getting inside the document.ready function. What am i doing wrong. Please help. Thanks in advance</p>