ajax封装回调函数代码
生活随笔
收集整理的這篇文章主要介紹了
ajax封装回调函数代码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
有時候項目需要封裝ajax代碼,請看一下內容:
?var ajaxfuncURL = function (url,type,restData,callback) {
??????????????? $.ajax({
??????????????????????? url: url,
??????????????????????? type: type,
??????????????????????? data: restData,
??????????????????????? timeout: 3600000,
??????????????????????? dataType: 'json',
??????????????????????? success: function (res) {
??????????????????????????? callback(res);
??????????????????????? },
??????????????????????? error: function (res) {
??????????????????????????? callback(res);
??????????????????????? }
??????????????? });
??????????? };
總結
以上是生活随笔為你收集整理的ajax封装回调函数代码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: js实现鼠标拖拽功能基本思路
- 下一篇: K-means聚类算法详解