没有样式的AJAX请求jQuery链接
我有这个密码。它获取请求数据并将其显示在DIV中并刷新 为什么它可以在DIV中显示请求的数据,如“简单文本”,但不能显示,例如此行:没有样式的AJAX请求jQuery链接,jquery,css,ajax,request,href,Jquery,Css,Ajax,Request,Href,我有这个密码。它获取请求数据并将其显示在DIV中并刷新 为什么它可以在DIV中显示请求的数据,如“简单文本”,但不能显示,例如此行: <a href="#" data-role="button">Button</a> 使用应用/呈现的CSS和jQuery.mobile按钮样式?我错过什么了吗 <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="ht
<a href="#" data-role="button">Button</a>
使用应用/呈现的CSS和jQuery.mobile按钮样式?我错过什么了吗
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
<script>
function GetData()
{
nocache = "&nocache=" + Math.random() * 1000000;
var request = new XMLHttpRequest();
request.onreadystatechange = function()
{
if (this.readyState == 4) {
if (this.status == 200) {
if (this.responseText != null) {
document.getElementById("buttons").innerHTML = this.responseText;
}
}
}
}
request.open("GET", "state" + nocache, true);
request.send(null);
setTimeout('GetData()', 1000);
}
</script>
</head>
<body onload="GetData()">
<div id="buttons" data-role="content">
</div>
</body>
</html>
函数GetData()
{
nocache=“&nocache=“+Math.random()*1000000;
var request=new XMLHttpRequest();
request.onreadystatechange=函数()
{
if(this.readyState==4){
如果(this.status==200){
如果(this.responseText!=null){
document.getElementById(“按钮”).innerHTML=this.responseText;
}
}
}
}
打开(“获取”、“状态”+nocache,true);
请求发送(空);
setTimeout('GetData()',1000);
}
替换此文档。getElementById(“按钮”).innerHTML=this.responseText代码>带有
$("#buttons").html(this.responseText);
我就是这么做的
另外,在使用jQuery时,可以用$(function(){//your code here})替换处理检查就绪状态等的大部分代码代码>
然后,您还可以取消
,只需使用