乐趣区

jquery-ajax增删改查

var getvideosbatchpush = function(para){return new Promise(function(resolve, reject){
        $.ajax({
            url: "/v1/pingan/videos-batch-push",
            type: "GET",
            // dataType: 'jsonp',
            contentType: "application/json",
            data: para || {},
            success: function(resp, status, xhr){if(resp.status == "OK"){resolve(resp);
                }else{reject(resp);
                }
            },
            error: function(xhr, errorType, error){Notify.fail("网络开小差了,请稍后再试");
            }
        });
  });
};
var deletevideosbatchpush = function(para){return new Promise(function(resolve, reject){
        $.ajax({
            url: "/v1/pingan/videos-batch-push/" + para.id,
            type: "DELETE",
            // dataType: 'jsonp',
            contentType: "application/json",
            data: JSON.stringify(para || {}),
            success: function(resp, status, xhr){if(resp.status == "OK"){resolve(resp);
                }else{reject(resp);
                }
            },
            error: function(xhr, errorType, error){Notify.fail("网络开小差了,请稍后再试");
            },
        });
  });
};
var savevideosbatchpush = function(para){return new Promise(function(resolve, reject){
        $.ajax({
            url: "/v1/pingan/videos-batch-push",
            type: "POST",
            // dataType: "jsonp",
            contentType: "application/json",        
            data: JSON.stringify(para || {}),
            success: function(resp, status, xhr){if(resp.status == "OK"){resolve(resp);
                } else{reject(resp);
                }
            },
            error: function(xhr, errorType, error){Notify.fail("网络开小差了,请稍后再试");
            },
        });
  });
};
var putvideosbatchpush = function(para){return new Promise(function(resolve, reject){
        var id = para.id;
        var url = "/v1/pingan/videos-batch-push/" + id;
        $.ajax({
            url: url,
            type: "PUT",
            // dataType: 'jsonp',
            contentType: "application/json",
            data: JSON.stringify(para || {}),
            success: function(resp, status, xhr){if(resp.status == "OK"){resolve(resp);
                } else{reject(resp);
                }
            },
            error: function(xhr, errorType, error){Notify.fail("网络开小差了,请稍后再试");
            }
        });
  });
};
退出移动版