0

I am trying to send data to a python script via POST but unable to read it. The UI is in AngularJS. I have seen similar questions but they are either not using AngularJS or not using POST.

The Angular code:

$scope.send = function(){

        $data = {
            "tableData":$scope.personsSelected
        }

        $postData = JSON.stringify($data);
        Services.post('testbed.cgi', $postData);
    }

Python Code:

formData = cgi.FieldStorage()
print json.dumps(formData)

Error Message:

TypeError: FieldStorage(None, None, []) is not JSON serializable

I have tried setting the content type to application/x-www-form-urlencoded but to no avail. What am I missing here?

1 Answer 1

0

The issue is with the data you are trying to send as JSON. Whats the data you are trying to send? Is it a Python object? This may help you. Are those plain strings? Dictionary? Do they have invalid characters? You can use JSON Lint to check validity.

1
  • javascript array, stringified Commented Oct 7, 2014 at 7:20

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.