In my View page jquery Ajax call like this
onclick: function() {
$.ajax({
type:'POST',
url:"<?PHP echo base_url('trand/report/checking'); ?>",
data: {nm:'vnky'},
success: function(){
alert("success");
},
error: function(){
alert("error");
}
});
chart2.exportChart({
type: 'image/png',
filename: dynmicfilename
});
}
exportchart function works perfectly .Inside ajax call also working alerts nice, but url is not executed, by using firebug when clicking the url in new tab , then it works fine.
How can I execute url in ajax call. can you help on this ?
Here's my code. My controller return json
data
$('.edit').click(function() {
$.ajax({
url: '<?php echo site_url('your_controller'); ?>',
type: 'POST',
data: {
key: value
},
dataType: 'json',
success: function(data) {
console.log(data);
}
});
});
Inside Ajax call, which alert is shown success or error? I think your JS code is correct. You should check your controller. If you open it in browser and it work fine. You should check csrf_protection config is TRUE or FALSE
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