Ajax实现网页get请求

 <!DOCTYPE html>
 <html>
 <head>
 	
 	<script src="jquery.js"></script>
 	<script type="text/javascript">
   //读取json.js
$(document).ready(function(){
 		$("#b1").click(function(){
 			
 			$.getScript("json.js");
 			});
 		});
 		//读取data.txt
 		$(document).ready(function(){
 		$("#b2").click(function(){
 			alert("come");
 			$.get("data.txt",function(data){alert(data);},"text");
 			});
 		});
 		function sendAjax(){
 			$.ajax({
 				url:"data.txt",dataType:"text",success:function(data,status){
 					alert("结果:"+data);
 					alert("状态:"+status);
 				},error:function(req,status,error){  
 					alert("状态:"+status);
 					alert("错误:"+error);
 				}
 			});
 			
 			};
 	</script>
 </head>
 <body>
 <input type="button" id="b1" value="button1">
 <input type="button" id="b2" value="button2">
 <input type="button" id="b3" value="button3" onclick="sendAjax()"/>
 </body>
 </html>

Ajax实现网页get请求,Cross origin requests are only supported for protocol schemes

运行结果:

Ajax实现网页get请求,Cross origin requests are only supported for protocol schemes

 

利用AJax实现get请求,在其他浏览器下成功,在IE下总为error,后来细看,报Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension错,目前还没解决

相关文章:

  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
  • 2022-12-23
  • 2022-01-13
  • 2021-11-26
猜你喜欢
  • 2022-12-23
  • 2021-05-16
  • 2021-06-16
  • 2021-12-29
  • 2021-05-09
  • 2022-12-23
相关资源
相似解决方案