title: jQuery ajax not connect web service .net (asmx)
body: <p>i connect javascript ajax to webservice asmx but not work.
  i test connect from aspx to webservice it work.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script src="jquery-3.1.1.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" language="javascript"&gt;
          $(function () {
              $('#btnCallService').click(function () {
                  $.ajax({
                      type: 'POST',
                      url: 'http://xxxxxxxx/ws/webservice.asmx/HelloWorld',
                      dataType: 'json',
                      contentType: 'application/json; charset=utf-8',
                      success: function (response) {
                          $('#lblData').html(JSON.stringify(response));
                      },
                      error: function (error) {
                          console.log(error);
                      }
                  });
              });
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;input type="button" id="btnCallService" value="GetEmployeeDetail" /&gt;
    &lt;label id="lblData"&gt;&lt;/label&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>after click button</p>
  
  <p><a href="https://i.stack.imgur.com/nsSF2.gif" rel="nofollow noreferrer">enter image description here</a></p>