官网小知识

网页宽度自适应手机屏幕

<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

两者都可以适配

我通过 媒体查询 来适配手机屏幕的

语法:

//当屏幕小于300px的时候body变成粉色

@media screen and (max-width: 300px) {
    body {
        background-color:pink;
    }
}

设置网页title图标

图标制作

图标制作

<link rel = "icon" href = "favicon.ico">

使用 jQuery ajax() 方法 请求数据

$(function() {
			$.ajax({
				type: "POST",//请求方式
				contentType: 'application/json;charset=UTF-8',//请求的媒体类型
				url: "请求地址",
				data: JSON.stringify(),//数据,json字符串
				//请求成功
				success: function(res) {
					if(res.code == 200){
						alert(res.message)
						window.location.reload() //成功之后刷新页面
					}
				},
				//请求失败,包含具体的错误信息
				error: function(e) {
					alert(e.responseJSON.message)
				}
			});
		});
	return false;

猜你喜欢

转载自blog.csdn.net/weixin_55552785/article/details/119108788