ajax jquery simple get request

前端 未结 5 2062
天命终不由人
天命终不由人 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条回答
  •  -上瘾入骨i
    2021-02-03 23:54

    You can make AJAX requests to applications loaded from the SAME domain and SAME port.

    Besides that, you should add dataType JSON if you want the result to be deserialized automatically.

    $.ajax({
            url: "https://app.asana.com/-/api/0.1/workspaces/",
            type: 'GET',
            dataType: 'json', // added data type
            success: function(res) {
                console.log(res);
                alert(res);
            }
        });
    

    http://api.jquery.com/jQuery.ajax/

提交回复
热议问题