开发者

jQuery.post doesn't return data if it gets Codeigniter php error

I'm trying to post this to the update_offer controller.

$.post(site_url+"/offer/update_offer", { variable: 'asdf' },
function(data) {
alert(data);
});

This will will normally return everything perfectly and alert the data. No problems.

The problem occur when I use:

$this->db->where('oID = '.$offer['oID'].' AND oCompanyid = '.$this->session->userdata('company'));
$this-开发者_如何转开发>db->update('offers',$offer);

... and it fails. Then it will not return or alert anything. If I go to the same page with my browser I get "A Database Error Occurred... ", which is just a html page.

Why doesn't that get returned in the $.post script?


Actualy you shoude use $.ajax to handle request. You woulde be able to make more configuration tought.

$.ajax({
    url: 'Bla.php',
    type: 'POST',
    success: function(data) {
        alert(data);
    },
    error: function() {
        alert('Error');
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜