开发者

Send a javascript array to server using JQuery

I want to send this array:

results = [1, 4, 5, 6]

So, I'm using this call:

$.ajax({
        url: 'save_record',
        type: 'POST',
        data: JSON.stringify({ sheets: results }),
        dataType: "json",
        success : function (data) {
            // Code here
        }
    });

But my PHP file is not receiving any parameter :( Wha开发者_如何学Got is wrong?


$.ajax({
        url: 'save_record',
        type: 'POST',
        data: {sheets:JSON.stringify(results)},
        dataType: "json",
        success : function (data) {
            // Code here
        }
    });


$.ajax({
    url: 'save_record',
    type: 'POST',
    data: {
        sheets: results 
    },
    dataType: "json",
    success : function (data) {
        // Code here
    }
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜