HTML5API_day02

day02內容

jQuery中的ajax
異步交互局部刷新,與後臺進行數據交互
http協議 請求報文和響應報文
瀏覽器控制檯網絡面板中查看請求和響應
請求頭 請求體,前端給後臺的參數
響應頭 響應體,後臺給前端的數據
發送請求,接受響應
前端與後臺對接接口,接口文檔,swagger可視化文檔
前端必須知道接口路徑,請求方式,攜帶的參數,後臺給的響應
約定後臺返回數據格式
{
“status”:200,
“message”:‘查詢成功’,
“data”:[]
}
$.ajax({
url:‘http://…’,
method:‘get’,
data:{
name:’’,
phone:’’
}, //給後臺的數據
success:function(res){
//res 後臺給前端的數據
if(res.status==200){
res.data
}
},
error:function(error){
console.log(error);
}
})
$.get(url,data,function(res){});
$.getJSON(url,data,function(res){});
$.post(url,data,function(res){});
$div.load(’./a.html’)
jQuery中的ajax給後臺發送的數據默認是表單格式的數據。
Content-Type:“application/x-www-form-urlencoded”

HTML5API
媒體元素
paused 是否暫停
volume 音量
currentTime 播放時間
playbackRate 播放速率
play()
pause()

畫布
DOM->context
context.fillStyle = ‘’;
context.strokeStyle = ‘’;
context.lineWidth = ‘’;
context.fillRect(x,y,width,height);
context.strokeRect(x,y,width,height);
context.clearRect(x,y,width,height);
路徑
context.beginPath();
//Math.PI/180*60
context.arc(x,y,r,startAngle,endAngle,direction);
context.moveTo(x,y);
context.lineTo(x,y);
context.lineTo(x,y);
context.lineTo(x,y);
context.bezierCurveTo(x1,y1,x2,y2,x,y);
context.quadraticCurveTo(x1,y1,x,y);
context.closePath();
context.fill();
context.stroke();

填充模式
context.fillStyle = ‘blue’;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章