开发者

jquery post to codeigniter problem

Ok, this is really driving me nuts.

I want to post a variable from jQuery to CodeIgniter. This is the code jQuery code I'm using:

jQuery call:

$.ajax({
 开发者_运维知识库 type: 'POST',
    url:  'http://sandbox.dev/tmp/livesearch',
    data: {
        "query": 'q_val',
        output: 'json',
        page: CURRENT_PAGE,
        limit: CURRENT_LIMIT
    },
    timeout:    '5000',
    dataType:   'json',
    beforeSend: function() {

    },
    complete: function() {

    },
    success: function(data, textStatus) {

    },

    // We're gonna hide everything when get error
    error: function(XMLHttpRequest, textStatus, errorThrown) {

    }
});

I've stripped to code to make it easier to read. The problem is that I end up in the error function with error code 200... which from what I've found on internet does not mean that something went wrong. Why isn't success called then? Do anyone have any good tutorial?


$(document).ready(function(){
    $('.delete').click(function(){
        $.post("http://sandbox.dev/tmp/livesearch", {'query' : "q_val", 'output' : "json", 'page' : CURRENT_PAGE, 'limit' : CURRENT_LIMIT}, function(data) {
             alert(data);
        });
    });
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜