Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/441.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Zendesk应用程序POST方法返回状态代码200,但正文返回null_Javascript_Api_Http_Browser_Zendesk App - Fatal编程技术网

Javascript Zendesk应用程序POST方法返回状态代码200,但正文返回null

Javascript Zendesk应用程序POST方法返回状态代码200,但正文返回null,javascript,api,http,browser,zendesk-app,Javascript,Api,Http,Browser,Zendesk App,当我在端点上使用request方法时,它会返回一个代码 但我的身体是空的。有人能帮我吗 $(function() { var client = ZAFClient.init(); client.invoke('resize', { width: '100%', height: '500px' }); client.get('ticket.requester.id').then( function(data) { var userId = data['ticket

当我在端点上使用request方法时,它会返回一个代码 但我的身体是空的。有人能帮我吗

$(function() {
  var client = ZAFClient.init();
  client.invoke('resize', { width: '100%', height: '500px' });

  client.get('ticket.requester.id').then(
    function(data) {
      var userId = data['ticket.requester.id'];
      requestUserInfo(client, userId);
    }
  );

});

    function requestUserInfo(client) {
      var settings = {
        url: `${url}`,
        type:'POST',
        headers : {
          "Content-Type": "application/json",
          "authorizationToken": "allow",
        },
        body : JSON.stringify({
          user_id: `${user_id}`
        }),
      };



      client.request(settings).then(
        function(data) {
          console.log(data)
        },
        function(response) {
          showError(response);
        }
      );
    }

我认为您没有看到预期结果的原因是,在函数
requesterUserInfo
方法中,您需要确保您也在传递ID,并确保将类型设置为GET而不是POST。
client.request(settings)
方法应该有一个显示数据的
。我建议您阅读Zendesk的文章:


我认为您没有看到预期结果的原因是,在函数
requesterUserInfo
方法中,您需要确保您也在传递ID,并确保将类型设置为GET而不是POST。
client.request(settings)
方法应该有一个显示数据的
。我建议您阅读Zendesk的文章: