0

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 :( What is wrong?

2 Answers 2

1
$.ajax({
        url: 'save_record',
        type: 'POST',
        data: {sheets:JSON.stringify(results)},
        dataType: "json",
        success : function (data) {
            // Code here
        }
    });
Sign up to request clarification or add additional context in comments.

Comments

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

1 Comment

This just sends a "Array" value to server :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.