So I am using the following code to send an ajax request
$.ajax({
type: 'POST',
url: base_url + "/notifications/send_notification",
dataType: 'json',
data: {
action: 'action_complete',
entity_id: 31
}
});
This code works perfectly on my local machine, but when I upload it to our server (which now has SSL setup), and try doing it over https and not http, it comes up with a "500 Internal Server Error".
P.s the "base_url" variable does include the "https" url.
EDIT: Here is a screenshot of the Network > Header tab in Chrome:
Perform network monitoring from your browser to read the body of the 500 Internal Server Error response. If you are sending JSON back make sure you apply AllowGet: true
.
Can you post a screenshot of the response body like this:
If base_url
is the website you're in, I mean if you enter your website in https://www.example.com, and base_url
is at https://www.example.com/notifications/send_notification then try to omit base_url
from the url
parameter.
If base_url
is another site then it might be some cross-site script issue.
If non of the above then it might be an issue with the server. Are you sure the SSL certificate is good? If it's self-signed then you need to "approve" it in the browser first.
Lastly, you can check the exact send/receive data with i.e Chrome, just F12 and check Network
(must be open before the request is made).
Additionally, you could directly request that url with Fiddler (if it's POST, if it's GET then simply get into it with a browser).