- 首页 > it技术 > >
日志 - 锐客网
系统日志列表页面Ajax
time:
id |
userName |
Method |
数据加载中。。。 |
package com.jt.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.jt.common.vo.JsonResult;
import com.jt.common.vo.PageObject;
import com.jt.entity.SysLog;
import com.jt.service.SysLogService;
@RequestMapping("/log/")
@Controller
public class SysLogController {
@Autowired
private SysLogService SysLogService;
@RequestMapping("doFindPageObjects")
@ResponseBody
public JsonResult doFindPageObjects(String username,Integer pageCurrent){
return new JsonResult(SysLogService.findPageObjects(username,pageCurrent));
}
@RequestMapping("doFindPageLogs")
public ModelAndView doFindPageLogs(String username,Integer pageCurrent){
PageObjectpageObject= SysLogService.findPageObjects(username, pageCurrent);
ModelAndView mv=new ModelAndView();
mv.addObject("pageObject",pageObject);
mv.setViewName("SysLog");
return mv;
}
@RequestMapping("doLogListUI")
public String doLogListUI(){
try {
Thread.sleep(5000);
} catch (Exception e) {
}
return "SysLog-Ajax";
}
}
【AJAX实现完整版】xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
必须先open再setRequestHeader,如果这样调整
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xhr.open("POST", url, true);
会报如下错
InvalidStateError: XMLHttpRequest state must be OPENED.
日志 - 锐客网
系统日志列表页面Ajax
time:
id |
userName |
Method |
数据加载中。。。 |
推荐阅读