title: Calling a javascript function from a global file and return it to append to html
body: <p><a href="https://i.stack.imgur.com/IBMkA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IBMkA.png" alt="enter image description here"></a>I have a global javascript file 'Global.js' with a Global Handler 'GlobalHandler.ashx', 
  what i am trying to do is to render some data in the back-end (inside the handler ), than return text data using <code>context.Response.Write(MyString)</code></p>
  
  <p>The question is how to append the data to my html element . 
  I looked into the response (200) and the data is there , but i don't know the reason of not appending my text into the html element</p>
  
  <p>I have tried to append them like the classic way <code>success:function(data){
  $(elementID).html(data);}</code>
  But that doesnt work </p>
  
  <p>Here In Global.js </p>
  
  <pre><code>function GetProfession(elementID) {
  $.ajax({
      url: "/Handlers/GlobalHandler.ashx",
      dataType: "JSON",
      contentType: "application/json;charset=utf-8",
      //responseType: ResponseType,
      data: {
          functionName: "GetProfession"
      },
      success: function (data) {
          return $("#" + elementID).html(data);
      }
  });
  }
  </code></pre>
  
  <p>Here In MyPage.aspx</p>
  
  <pre><code>    $(document).ready(function () {
          GetProfession("Profession");
      });
  </code></pre>
  
  <p>HERE In the Handler </p>
  
  <pre><code> string functionName = context.Request["functionName"];
          GroupDAO GroupDAO = new GroupDAO();
          if (functionName.Equals("GetProfession"))
          {
              var ListOfGroups = GroupDAO.GetGroups();
              string Builder = "";
              foreach (var group in ListOfGroups)
              {
                  Builder+="&lt;option value='" + group.GroupID + "'&gt;" + group.GroupName + "&lt;/option&gt;";
              }
              context.Response.Write(Builder);
          }
  </code></pre>
  
  <p>I am expecting to have those options appended to the html element 'Profession'
  but this unfortunately it does not happening</p>