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
}
});
精彩评论