title: Forcing AJAX call to be HTTPS from HTTPS Page
body: <p>Currently making an AJAX call from a HTTPS jsp to call in data from another jsp page. We are however getting a Mixed content issue: </p>
  
  <blockquote>
    <p>Mixed Content: The page at '<a href="https://etc/" rel="noreferrer">https://etc/</a>' was loaded over HTTPS, but
    requested an insecure XMLHttpRequest endpoint
    '<a href="http://etc/path/to/other/page.jsp" rel="noreferrer">http://etc/path/to/other/page.jsp</a>'. This request has been blocked;
    the content must be served over HTTPS.</p>
  </blockquote>
  
  <p>How do you force an AJAX call to call over HTTPS? </p>
  
  <p>The AJAX call looks like the following:</p>
  
  <pre><code>var url = "/path/to/other/page.jsp";
  
  $.ajax({                                                            
      type: "POST",
      url: url,
      data: {data: data},
      dataType: "html",
      timeout: 4000, 
      success: function(html) {
          /* Code on Success */
          }
      },
      error: function(request, status, error) {
           /* Code on Failure
      }   
  });
  </code></pre>
  
  <p>I could understand if I was trying to make a call from HTTPS to HTTP, but I don't want to. I want to force this to call the JSP using HTTPS is all, so I can avoid the Mixed Content issue. </p>
  
  <p>Thank you in advance! </p>
  
  <p>/* EDIT */</p>
  
  <p>Interestingly I put in the variable URL an absolute path:</p>
  
  <pre><code>var url = "https://etc/path/to/other/page.jsp";
  </code></pre>
  
  <p>And I got the same issue. Something is forcing this AJAX call to be HTTP?</p>