Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery - SSL $.post

If I serve a page over SSL, and I do an AJAX post:

$.post('/core/somepage.php', ....);

Will the post be made via HTTPS, or do I have to put an absolute URL like:

$.post('https://example.com/core/somepage.php', ....);

Also, does this apply with :

$('#element').load('/core/something.php');

?

like image 407
Qiang Avatar asked Aug 18 '12 21:08

Qiang


1 Answers

Yes, the post will be made via https. Relative paths by definition use the current scheme. Did you know, you can even do something like //example.com/somepage if you want to go to an explicit host but keep the current scheme.

like image 102
bhamlin Avatar answered Oct 21 '22 10:10

bhamlin