Forum OpenACS Development: AJAX request a page on HTTPS on HTTP

Request notifications

Posted by Iuri Sampaio on
Hi there,

I started to write a solution to provide a website on HTTPS once the user whether logs on signs in the system.

Login and "Join Us" are links within the header that trigger a popup with forms to whether log in or sign up. I wrote those as the html tag "href" as javascript calls that do an ajax request to the page

Join us

function joinow(id){
var actionHandler = "";
type: "POST",
url: actionHandler,
data: "id="+id,
dataType: "json",
beforeSend: function(msg)
success: function(response){

The problem lays on JS variable actionHandler. It must be https to call login/sign always on HTTPS but that causes a javascript error "Cross-Origing Request Blocked"

"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at This can be fixed by moving the resource to the same domain or enabling CORS."

The goal is to include a ajax request to an HTTPS page on a HTTP page.

So, the form will be in HTTPS and if the user logs or signs in he will be on HTTPS forever.

Would CURL be the solution for it?

What would be be best approach to it?