Reputation: 321
How can I do a https-tls protocol ajax post with JQuery? Does It follow the protocol of source page?
Upvotes: 0
Views: 3911
Reputation: 780984
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:
How to change http/https Protocol while using relative URL
Upvotes: 1