How can I do a https-tls protocol ajax post with JQuery? Does It follow the protocol of source page?
Asked
Active
Viewed 3,777 times
1 Answers
1
URLs in AJAX calls are interpreted in pretty much the same way as URLs in links. If you want to force HTTPS, put the https:
prefix in the URL in your AJAX call. If you omit the protocol it will use the same protocol as the source page.
However, if you change the protocol, it doesn't default the rest of the URL from the current URL. While this might be reasonable when switching between HTTP and HTTPS, it doesn't generalize: you're unlikely to want to copy pieces of the current http:
URL into a mailto:
URL, for instance. See this question:
-
SO can I use something like **'url: "https:./example.php"'** or **'url: "https:../example.php"'** ? @Barmar – willypuzzle Oct 01 '13 at 17:24
-
Actually, I think that's wrong. See http://stackoverflow.com/questions/6629696/how-to-change-http-https-protocol-while-using-relative-url – Barmar Oct 01 '13 at 17:28