score:3

There are three steps to a successful multipart post.

  1. Add the header Content-type: application/x-www-form-urlencoded
  2. Encode the form data
  3. Concatenate it as if you were specifying query strings in a URL

Then just send it as the POST data.

None of this is specific to d3, but I thought I'd give my answer and some sample code, since I landed here.

Sample code:

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));
});

Related Query

More Query from same tag