title: Bypassing SSL certificate error in jQuery and AJAX
body: <p>I am newbie to jQuery/AJAX. I have a small application for testing pupose that has a button on it. When the button is clicked a connection is made to a server located in the same domain to get some data and alert it.</p>
  
  <p><strong>Problem</strong>: My application can't make any connection to the server. The following screen shot is from the developer tools in google chrome.</p>
  
  <p><img src="https://i.stack.imgur.com/MzS1S.png" alt="eror"></p>
  
  <p>The server has its own self signed certificate. If I connect to the server via web browser I get an SSL certificate warning as shown below. </p>
  
  <p><img src="https://i.stack.imgur.com/N8iv9.png" alt="ssl-error"></p>
  
  <p>If I click on proceed and then login to the server, after this now my application is also able to retieve the data from the server.(If I click the button on my web app it alerts the data it got from the server.) </p>
  
  <p><strong>Question:</strong> Is there any workaround for this, can I bypass this error? Why it works once I have logged in to the server via web browser? My app will be used locally in the same domain and it is not a public app.</p>
  
  <p><strong>jQuery Code</strong>: I have this code:</p>
  
  <pre><code>$('#mybutton').click(function(){
      $.ajax({
          type: "GET",
          url: "https://192.168.150.33/Api/loc?jsonpCallback=myCallback",
          dataType:"jsonp",
          async: false,
          beforeSend: function (request){
              request.withCredentials = true;
              request.setRequestHeader("Authorization", "Basic " + btoa('admin' + ":" + 'password'));
              },
          success: function(response){
                  alert('hi');
              },
      });
  });
  function myCallback(response){
          data= JSON.stringify(response)
          alert(data)
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/21292862/ajax-request-failing-due-to-invalid-ssl-cert">Here</a> is a post that addresses the same issue. As far as I understood this post according to it there is no solution. Any suggestions will be helpful. Thanks</p>