javascript - d3.json what kind of request its making? -
I am using this D3 plugin: loading json data from local url, I usually use it in PHP Control adds whether the call is a proper AJAX call:
define ('IS_AJAX', issued ($ _ server ['HTTP_X_REQUESTED_WITH']) and the Stroller ($ _ server [ HTTP_X_REQUESTED_WITH ']) ==' XMLHttpRequest '); This check has failed and I was able to back it up on the d3.json function.
Can someone explain to me what kind of request D3 Jason is making?
Thank you very much.
Edit:
This code is:
& lt; Script type = "text / javascript" & gt; Var cal = New CalHeatMap (); Cal.init ({cellSize: 15, Category: 12, Domain: "month", data: '& lt ;? php echo $ url;? & Gt; Legend horizontal position:' center ', legendselles: 15}); & Lt; / Script & gt; $ url is the url which returns json.
The first of its documentation is unclear how data is processed . Then we can put a quick look at the code (line 2459 src \ cal-heatmap.js) switch (type off source) {case "string": if (source === " " ) { _call back({}); Back true; } And {switch (this.options.dataType) {case "Jason": d3.json (this. From URI (source, start, end date), _callback); break; When we pass a string instead of an object, it checks the extension and uses the D3 support method, such as d3.json () should behave like d3.XHR () wrap around. No document says that it sends HTTP_X_REQUESTED_WITH Many other frameworks do this so that you see it almost universal method to detect an AJAX call but it is not necessary.
Comments
Post a Comment