Unable to make AJAX calls over HTTPS
Unable to make AJAX calls over HTTPS
I'm working on deploying a site for a client, and just noticed that applying the SSL cert and HTTPS redirect somehow broke the AJAX calls across the site.
I am making the AJAX call as so:
$('#customers').DataTable( {
"scrollX": true,
"bSortClasses": false,
"processing": true,
"serverSide": true,
"ajax": "{{ url('ajaxcustomers/'.$client_id.'/') }}",
"columns": [
{ data: 'name', name: 'name' , width: '150px'},
{ data: 'first', name: 'first', width: '150px'},
{ data: 'last', name: 'last', width: '150px' },
{ data: 'address', name: 'address', width: '200px'},
...
]
});
The exact code worked on both my staging server and the production server prior to applying the SSL cert and forcing HTTPS. I have verified the URL being used for the GET is HTTPS, but the URL itself is over 8000 characters long:
https://MYDOMAIN.dev/ajaxcustomers/2?draw=1&columns%5B0%5D%5Bdata%5D=name&columns%5B0%5D%5Bname%5D=name&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=true&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D[...]
Can someone please verify that no additional changes need to be made on my end to support making AJAX calls over HTTPS, and that the URL being used in the GET is expected to be of that format?
Thanks in advance! I've been at this for quite a while now to no avail.
This question has an accepted answers - jump to answer
Answers
You will want to switch your ajax request to POST from the default GET.
https://datatables.net/examples/server_side/post.html
-Rhon
I'll be damned - that's all it was. I feel foolish for not realizing that sooner. Thanks!