There are three steps to a successful multi-page post.
- Add
Content-type: application/x-www-form-urlencoded header Content-type: application/x-www-form-urlencoded - Encode form data
- Combine it as if you specified query strings in the URL
Then just send it as POST data.
None of this is specific to d3, but I thought I would give my answer and some sample code, since I landed here.
Code example:
var xhr = d3.xhr(post_url) .header("Content-type", "application/x-www-form-urlencoded"); xhr.post("arg1=" + encodeURIComponent(arg1) + "&arg2=" + encodeURIComponent(arg2), function(error, result) { if(error) throw new Error(error); read_paths.data(JSON.parse(result.responseText)); });
source share