d3.json works but $.getJson fails

感情迁移 提交于 2019-12-12 05:09:21

问题


Using d3.json to make a json request works while $.getJson and $.ajax fail. It is not a cross-domain problem as I am requesting a script on the same domain.

d3.json('api.php?q=/user/authUser?authemail=email%26authpassword=pass', function(d) {

        console.log(d);

});

In console --> network, the d3 request correctly shows api.php as the path but with $.getJson or $.ajax I get the web service route (web.myapp.local) as the path.

Isn't d3.json just a wrapper for $.getJson. If so, why is the request path different for each.


回答1:


I figured out the problem, I was using mockjax, a javascript library to intercept ajax calls and it was causing the problems. Solved it by completely removing the library.

This might not be a problem with the latest releases - but it was at the time



来源:https://stackoverflow.com/questions/10622414/d3-json-works-but-getjson-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!