String se mě zobrazuje pouze v <input id="string" type="text" /></p> ale já ho potřebuji vložit do běžného textu ne do input.
Tohleto prostě nefunguje: <p id="string">text</p>
Zde je celí kód:
- Kód: Vybrat vše
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Info_Panel v 0.1</title>
<style>
body
{
color: rgb(157, 255, 0);
background: black;
font-family: Arial, Helvetica, sans-serif;
text-align: center;
}
footer
{
color: rgb(48, 73, 67);
margin: 0;
font-size: 12px;
}
article
{
border: 1px solid #ccc;
margin: 50px;
margin-left: auto;
margin-right: auto;
padding: 50px;
max-width: 420px;
}
</style>
<script type="text/javascript" src="jquery-1.12.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function ()
{
GetData();
});
function GetData()
{
var url = 'https://api.thingspeak.com/channels/1981429/feeds.json?key=PRJA98LHWOBMFOZV&results=1';
$.ajax
({
url: url,
type: 'GET',
contentType: "application/json",
//dataType: "json",
//crossDomain: true,
success: function (data, textStatus, xhr) {
$.each(data, function (i, item) {
if (i == 'feeds') {
var ubound = item.length;
$('#txtField1').val(item[ubound - 1].field1);
$('#txtField2').val(item[ubound - 1].field2);
$('#txtField3').val(item[ubound - 1].field3);
}
});
},
error: function (xhr, textStatus, errorThrown) {
alert(errorThrown);
}
});
setTimeout(GetData, 10000);
}
</script>
</head>
<body>
<article>
<header>
<h1>Info_Panel</h1>
</header>
<p>Mamča: <input id="txtField2" type="text" /></p>
<p>Tech: <input id="txtField3" type="text" /></p>
<p id="txtField1">test</p>
<footer>
</footer>
</article>
</body>
</html>
Děkuji všem za radu už si nevím rady.