栗子

//新增
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://leancloud.cn/1.1/classes/Post",
    "method": "POST",
    "headers": {
        "x-lc-id": "CiHr9Qq9lBIjQ37TGpFmlKUR-gzGzoHsz",
        "x-lc-key": "DJFhjkC4gxQQNIoqpKdIuzqs",
        "content-type": "application/json"
    },
    "processData": false,
    "data": "{\n\t\"title\":\"标题001\",\n\t\"content\":\"balabalabalabalabala\",\n\t\"tags\":[\"javascript\",\"node\"]\n}"
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
// 删除
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://leancloud.cn/1.1/classes/Post/597d8c6aa22b9d006d44e0f2",
    "method": "DELETE",
    "headers": {
        "x-lc-id": "CiHr9Qq9lBIjQ37TGpFmlKUR-gzGzoHsz",
        "x-lc-key": "DJFhjkC4gxQQNIoqpKdIuzqs"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
// 修改
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://leancloud.cn/1.1/classes/Post/597cae6ea0bb9f0058100089",
    "method": "PUT",
    "headers": {
        "x-lc-id": "CiHr9Qq9lBIjQ37TGpFmlKUR-gzGzoHsz",
        "x-lc-key": "DJFhjkC4gxQQNIoqpKdIuzqs",
        "content-type": "application/json"
    },
    "processData": false,
    "data": "{\n\t\"title\":\"标题001\",\n\t\"content\":\"balabalabalabalabala\",\n\t\"tags\":[\"javascript\",\"node\"]\n}"
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//查询列表

var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://leancloud.cn/1.1/classes/Post",
    "method": "GET",
    "headers": {
        "x-lc-id": "CiHr9Qq9lBIjQ37TGpFmlKUR-gzGzoHsz",
        "x-lc-key": "DJFhjkC4gxQQNIoqpKdIuzqs"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
// 查询单条
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://leancloud.cn/1.1/classes/Post/597cae6ea0bb9f0058100089",
    "method": "GET",
    "headers": {
        "x-lc-id": "CiHr9Qq9lBIjQ37TGpFmlKUR-gzGzoHsz",
        "x-lc-key": "DJFhjkC4gxQQNIoqpKdIuzqs"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

你可能感兴趣的:(栗子)