I have a strange situation where I am loading some content into a modal using jQuery load(). This is working perfectly in development but on the production server, the object is being ignored and only sending a GET request. I've checked the typeof
object which is successful and tried other variations in the second parameter of the load method. Never had this before.
var $modal = $('#ajax-modal');
$('body').modalmanager('loading');
//_token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
setTimeout(function(){
var _post = {ajax:true, lead:lead, type:type };
$modal.load('leads/action/', _post, function(){
});
}, 1000);
Headers:
Request URL:http://mydomain/leads/action
Request Method:GET
Status Code:200 OK
I'm also getting Provisional headers are shown
in Chrome.
The script should POST
to the url and load the data into the modal. Below are the headers sent when I'm on my local server:
ajax:true
lead:4273
type:reminder
Any pointers would be appreciated
It's a Redirection problem: When you POST
your request to leads/action/
your server redirects it to leads/action
with a GET
request. You can resolve this by removing the trailing slash:
$modal.load('leads/action', _post, function(){
//^ Here
});
I hope this will help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With