Srinidhi Nagendra
Srinidhi Nagendra

Reputation: 45

What is the data type of the 'data' argument in d3.request.get?

As an Object :

d3.request('get_movies').get({"actors":"Shah Rukh Khan"},function(){
     console.log(arguments);
});

As a JSON representation of the object:

d3.request('get_movies').get(JSON.stringify({"actors":"Shah Rukh Khan"}),function(){
     console.log(arguments);
});

I could find documentation as to what should be passed as the data argument https://github.com/d3/d3-request/blob/master/README.md

I tried a few and none of them seem to send the query string parameters upon inspecting. Nor does it construct the respective URL

Edit :

I also tried passing a simple string URL encoded

d3.request('get_movies').get("actors=Shah%20Rukh%20Khan",function(){
     console.log(arguments);
});

Upvotes: 0

Views: 259

Answers (1)

Chirag Kothari
Chirag Kothari

Reputation: 1410

query parameters should be added to the url:

d3.request('get_movies?actors=Shah%20Rukh%20Khan').get(function(){
     console.log(arguments);
});

Upvotes: 1

Related Questions