Qiang
Qiang

Reputation: 656

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');

?

Upvotes: 6

Views: 2973

Answers (1)

bhamlin
bhamlin

Reputation: 5187

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.

Upvotes: 7

Related Questions