2024-04-20 14:07:28 发布
网友
我有一个django端点:
def endpoint(request): return HttpResponse("Hello!")
我在JS中这样称呼它:
fetch(baseUrl + "endpoint", { method: "POST", }).then(function(data) { // HOW DO I ACCESS THE "Hello!"? });
如何访问hello!在那一部分?谢谢
大概是这样的:
fetch(baseUrl + "endpoint", { method: "POST", }).then(function(data) { data.text().then( text => console.log(text) ); });
大概是这样的:
相关问题 更多 >
编程相关推荐