Whenever I create an jQuery.ajax request it works fine when the URL uses the HTTP protocol. But when I send the same request to the HTTPs server, it is sent without the header [HTTP_X_REQUESTED_WITH: XMLHttpRequest]. Thus the server has no way of knowing that this is an AJAX request!
I’ve tried:
- Switching $.ajax, $.post, $.get
- Forcing the header using
beforeSend - Setting
CrossDomain:true
Note: There are no cross-domain issues, the request is valid and handled, but not as AJAX.
This issue happens when the current URL is http but the requested URL is on the same domain but uses HTTPS.
http://example.com/home
will use AJAX POST to post to
I got the same issue for doing same stuff between http and https.
I have researched this and it is cross domain issue. Please try JSONP with call back function for doing the stuff, and the most important thing the server side page you are using for doing curl has to set some headers for allowing http to https connection. These are below: