src/main/webapp/jsp/utils/baseUrl.jsp

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
var baseUrl = "http://localhost:8080/jspm43cv5/";
var projectName = "黄梅戏剧团管理系统哈尔"

/**
 * 网络请求
 * @param {Object} url		地址
 * @param {Object} method	get/post
 * @param {Object} param	参数
 * @param {Object} callback	回调函数
 */
function http(url, type, data, callback) {
	url = baseUrl + url;
	$.ajax({
		url: url,
		beforeSend: function(request) {
			request.setRequestHeader("token", window.sessionStorage.getItem("token"));
		},
		contentType: 'application/x-www-form-urlencoded',
		data: data,
		dataType: 'json',
		type: type,
		success: function(result, status, xhr) {
			if (result.code == 0) {
				callback(result);
			} else if (result.code == 401) {
				window.location.href = '${pageContext.request.contextPath}/jsp/login.jsp';
			} else {
				alert(result.msg)
			}
		},
		error: function(xhr, status, error) {
			console.log(xhr, status, error)
		}
	});
}

function httpJson(url, type, data, callback) {
	url = baseUrl + url;
	var params = null;
	if (data) {
		var params = JSON.stringify(data);
	}
	$.ajax({
		url: url,
		beforeSend: function(request) {
			request.setRequestHeader("token", window.sessionStorage.getItem("token"));
		},
		contentType: 'application/json',
		data: params,
		dataType: 'json',
		type: type,
		success: function(result, status, xhr) {
			if (result.code == 0) {
				callback(result);
			} else if (result.code == 401) {
				window.location.href = '${pageContext.request.contextPath}/jsp/login.jsp';
			} else {
				alert(result.msg)
后面还有 7 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。