Ajax框架整合

2021-07-22 07:18:16 字數 1031 閱讀 6133

我們知道,每次根據不同介面,寫不同的ajax是一件比較麻煩的事兒,但是又不逃避他們,那麼該腫麼辦呢,下面給大家介紹一種整合框架,可以根據與不同介面去建立不同的ajax

lang="en">

charset="utf-8">

title>

head>

function

ajax

(option);

//迴圈遍歷傳參

for(var p in option)

//url後的資料處理

var requestdata = '';

if(typeof setting.data == 'object')

requestdata = arr.join('&');

}else

//非同步處理

//是否超時

xhr.timeout = setting.timeout;

xhr.ontimeout = function

(); //報錯

xhr.onerror = function

(); //是否非同步操作

if(setting.async)

}else

//處理請求結果

function

doresult

() }

}//新增請求頭

function

addheader

() }}}

ajax(,

success:function

(data),

error:function

(data)

})script>

body>

html>

SSH框架整合

首先將 spring 加入到web容器在 web.xml 中加入 context param param name contextconfiglocation param name 說明 為了管理方便設定了多個 spring 的配置檔案 context param 然後加入 spring liste...

SSI框架整合

框架版本 struts2 spring2.5 ibatis 1,新建乙個web project。3,匯入spring的jar包 4,匯入的struts的jar包 5,加入ibatis jar包 classpath sqlmapconfig.xml sqlmapconfig.xml檔案 為 jdbc....

框架的整合

一 三大框架的整合步驟 新建乙個工程 把整個工程的編碼改變成utf 8 把整個jsp頁面也改變成utf 8 導包 web inf libstruts hibernate spring dbjunit 建三個src folder src 存放源 的 cn.itcast.s2sh0909.struts2...