Q:

JSON AJAX url wants more

I am using D3 to create some county data with their choropleth example. I am using the d3.json option vs. the jquery .ajax. I have a URL that when I use it just does not load. After some research I found that the web service requires an additional parameter: 
   {'county': {'year': 2002,'stat': 'crime'}} 

So the connection to this url keeps failing on me.
I tried to add the additional required parameters for the web service as follows:
d3.json("http://url/states", function (json) {
    data = "{'county': {'year': 2002,'stat': 'crime'}}"
    //basic d3 stuff from here below
    counties.selectAll("path")
        .attr("class", quantize);
    dataType = json,
        contentType = "application/json; charset=utf-8";
});

I just cannot connect without those params in the call and I am not sure how to incorporate them.

A:

Part of your problem is that you try to configure the request to the web service you want to call in the code that is used to deal with the response of the web service. 
It seems that d3 doesn't give you the flexibility you need if you cannot pass the required parameters in the url (e.g. http://web.service.com/states?level=county&year=2002&stat=crime). To solve this you'll have to fall back to either raw JavaScript and construct the appropriate XMLHttpRequest such as shown here: Simplest SOAP example. Or, if you're using libraries such as jquery or dojo there might be more convenient ways to achieve the same.
Once you get the result from the request, you can use the data sent with the result (assuming that it is json) and plug in d3 to visualize.

