jquery ajax 的封裝

(二少)在南極發表於2013-11-19

var tooAjaxData = new Object();

tooAjaxData = function () {
this.AjaxUrl =" ";
};

bookInfoClient.Data.prototype = {
AjaxGet: function () {
$.ajax({
type: "GET",
url: arguments[3] || this.AjaxUrl,
data: arguments[0] || "",
dataType: "jsonp",
jsonp: "callbackparam",
jsonpCallback: arguments[1] || "bookInfo",
success: arguments[2] || function () { },
complete: function (XHR, TS) { XHR = null }
});
},
DownLoadtest: function () {
if (arguments.length != 3) return;
var data = { ajaxMethod: "getforstorage", bookid: arguments[0], chapterid: arguments[1] };
this.AjaxProcess(data, "DownLoadCurChapter", arguments[2],  "Book/BookReader.ashx");
},
GetBookInfo: function () {
if (arguments.length != 2) return;
var data = { ajaxMethod: "getbookinfo", bookid: arguments[0] };
this.AjaxProcess(data, "getbookinfo", arguments[1]);
},
GetVolumeChapter: function () {
if (arguments.length != 3) return;
var data = { ajaxMethod: "getallvolumechapter", bookid: arguments[0], isreadvip: arguments[1] };
this.AjaxProcess(data, "getallvolumechapter", arguments[2]);
}

}

 

相關文章