Skip to content

Instantly share code, notes, and snippets.

@ideacco
Created August 9, 2019 18:57
Show Gist options
  • Save ideacco/c022be31c93d706931e68426dfb03c68 to your computer and use it in GitHub Desktop.
Save ideacco/c022be31c93d706931e68426dfb03c68 to your computer and use it in GitHub Desktop.
一个Wp的AJAX请求
<ul uk-tab uk-switcher="animation: uk-animation-fade">
<li><a href="#">
<h3>Changelog</h3>
</a></li>
<li><a href="#">
<h3>Planned</h3>
</a></li>
</ul>
<ul class="uk-switcher uk-margin">
<li>
<div id='loghtml'></div>
</li>
<li>
<div id='planned'></div>
</li>
</ul>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
url: "/changelog/changelog.html",
dataType: "text", //数据格式
type: "get", //请求方式
async: true, //是否异步请求
success: function(data) {
let html_log = "";
html_log += data;
$("#loghtml").html(html_log);
}
})
})
</script>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
url: "/changelog/Planned.html",
dataType: "text", //数据格式
type: "get", //请求方式
async: true, //是否异步请求
success: function(data) {
let html_plan = "";
html_plan += data;
$("#planned").html(html_plan);
}
})
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment