为何从GitHub获取的JavaScript表单无法正常运行?
问题:嵌入GitHub存储的JavaScript表单失效
我想在个人网站展示存储于GitHub中的JavaScript表单,但浏览器会直接跳过表单内容,转而显示noscript标签的内容;移除noscript标签后,表单依旧无法正常工作。
效果对比
- 预期效果:

- 当前实际效果:

我的当前代码
<!DOCTYPE html> <html> <head> <title>js test</title> <meta charset="utf-8"> <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script> </head> <body> <div id="index_block"></div> <button onclick="hello()"><a>get data</datagrid></a></button> </body> <script> function hello(){ $.ajax({ url:'https://raw.githubusercontent.com/Rduanchen/hserpsystem/edfc042eec06225eb818f1db2ea77a8f768262b3/WEB_2/sub_index_web/Serch_general.html', method:'get', dataType:'Text', success:function(data){ console.log(typeof(data)); $(document).ready(function(){ document.getElementById('index_block').innerHTML=data; }) }, }); }; </script> </html>
内容的提问来源于stack exchange,提问作者Rduan
相关产品推荐
相关产品推荐

