I have two AJAX requests on the same page sending data to a Codeigniter framework.
One sends a form of input fields containing shop opening hours. This functions correctly.
$(".hour-field").blur(function(){
$.ajax({
url:'<?php echo base_url(); ?>businesses/updatehours',
type: 'POST',
dataType: 'json',
data: $("#edit-hours").serialize(),
success: function(data){
console.log(data);
},
error: function(data){
console.log(data)
}
});
});
The other sends data from a radio input form. This one returns ERR_CONTENT_DECODING_FAILED 200
$(".image-selector").click(function(e){
$.ajax({
url:'<?php echo base_url(); ?>businesses/selectimage',
type: 'POST',
dataType: 'json',
data: $("#select-image").serialize(),
success: function(data){
console.log(data);
},
error: function(data){
console.log(data)
}
});
});
I have tried removing the 'dataType' without success.
There is seemingly no difference between the two but one is not working.