Я ожидал, что этот код запишет, будет ли число раз, когда я нажимаю кнопку, четным или нечетным? Вместо этого ничего не происходит.
мой index.html
<html>
<head>
<script type="text/javascript" src="shared/jquery.js"></script>
<script type="text/javascript" src="shared/shiny.js"></script>
</head>
<body>
<input type="submit" name="submit" value="Press me!" class="button">
<p><div id="text" class="shiny-text-output" style="width: 150px; height: 25px; border: 1px solid black;"></div>
</body>
</html>
мой сервер.R
shinyServer (function (input, output, session)
{
observe ({
x = input$button;
output$text = renderText ({
if (! is.null (x))
{
if (x %% 2 == 0) {
"You are even";
}
else {
"You are odd";
}
}
})
});
})