J
J
jww2018-10-03 00:20:36
AJAX
jww, 2018-10-03 00:20:36

Not passing AJAX requests?

Good day. Error when trying to send AJAX request in console: jquery-2.1.4.min.js:4 Mixed Content: The page at ' https://*****.com/cargo/calc-temp/ ' was loaded over HTTPS , but requested an insecure XMLHttpRequest endpoint ' http://****.com/cargo/handler.php '. This request has been blocked; the content must be served over HTTPS.
There are no problems on the local computer.
Request:

$.ajax({
       type: "POST",
       url: "handler.php",
       data: form_data,
       success: function(response) {

       },
       error: function(response) { 
        alert('Error');
       }
     });

I tried to change the url to relative, full, with http, https - nothing helped.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Q
qq1, 2018-10-03
@qq1

If the main site is loaded via https, then all resources must be requested via a secure protocol, so the link to handler.php must be with https. Actually, this is indicated by the error:

This request has been blocked; the content must be served over HTTPS

X
xmoonlight, 2018-10-03
@xmoonlight

set up CORS on the server

J
jwwwe, 2018-10-03
@jwwwe

The problem was in htaccess

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question