ajax 读取本地文件,jquery读取本地文件

$(document).ready(function(){

$("#b01").click(function(){

htmlobj=$.ajax({url:"/jquery/test1.txt",async:false});

var temp=htmlobj.responseText; alert(temp);

$("#myDiv").html(htmlobj.responseText);   });

});


$("#one a").css("cursor", "pointer").click(function () {
$.post("course/popular/content1.html",null,function(data){
alert(data);//这里data为content1.html文件里的内容
});
});

原文地址:https://www.cnblogs.com/zxh1919/p/15209180.html