【发布时间】:2016-06-06 05:17:57
【问题描述】:
我尝试通过jQuery.get() 读取降价文件的内容,以便可以使用降价内容。但它不起作用。
Firebug 控制台报告如下:
start logging ondex.html:17:4
end logging ondex.html:21:4
not wellformed readme.md:1:2
not wellformed ondex.html:1:2
不知何故,文件readme.md 被读取,但有些东西格式不正确。我想,这会导致麻烦......
这是降价文件。也可以在 Github 上找到:readme.md
# jerik.github.io
snippset and things I want to capture / document
## todos
- Integrate Navigation dropdown with my pages. The page names should be stated in a tag ( meta-tag, own-tag.. ), so that it can be read by js.
- For Layout see: https://bootswatch.com/cerulean/
- [...]
在我调用 jQuery.get() 来读取 markdown 文件的 html 文件的代码下方。可在 Github ondex.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Jerik's this and that</title>
<meta name="description" content="Some stuff that I want to mention" />
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript" charset="utf-8">
// [...]
console.log( 'start logging' );
$.get( "readme.md", function( data ) {
console.log( data ); // this is not called !!
});
console.log( 'end logging' );
</script>
</head>
<body>
<center>das iste in test</center>
<textarea id="ta" theme="cerulean" style="display:none;">
hallo
</textarea>
<script src="v/0.2/strapdown.js"></script>
</body>
</html>
如何获取 markdown 文件的内容,以便使用?
【问题讨论】:
标签: javascript jquery html get markdown