ajax jquery simple get request

前端 未结 5 2060
天命终不由人
天命终不由人 2021-02-03 23:31

I am making this simple get request using jquery ajax:

$.ajax({
    url: \"https://app.asana.com/-/api/0.1/workspaces/\",
    type: \'GET\',
    success: functio         


        
5条回答
  •  鱼传尺愫
    2021-02-03 23:31

    i think the problem is that there is no data in the success-function because the request breaks up with an 401 error in your case and thus has no success.

    if you use

    $.ajax({
            url: "https://app.asana.com/-/api/0.1/workspaces/",
            type: 'GET',
             error: function (xhr, ajaxOptions, thrownError) {
        alert(xhr.status);
        alert(thrownError);
      }
        });
    

    there will be your 401 code i think (this link says so)

提交回复
热议问题