首页 > 其他分享 >手写一个简易的ajax

手写一个简易的ajax

时间:2022-12-22 13:57:41浏览次数:28  
标签:function xhr url 简易 ajax 手写

function ajax(url,successFul){

const xhr=new XMLHttpRequest()

xhr.open("Get",url,true)

xhr.onreadystatechange=function()

{

if(xhr.readyState===4){

if(xhr.state===200){

successFn(xhr.responseText)

}

xhr.send(null)

}

 

标签:function,xhr,url,简易,ajax,手写
From: https://www.cnblogs.com/cmycmy/p/16997980.html

相关文章