I`ve just started using webpd and I would be happy if someone showed me how to properly write a very simple HTML & javascript code connected to the pd patch, which has a slider that fires the moment when the value of the element is changed.
<!doctype HTML>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="../js/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="../js/webpd-latest.js"></script>
<script type="text/javascript" src="../js/elindit.js"></script>
</head>
<body>
<button id="startButton">Start</button>
<div id="controls">
<form>
<input type="text" id="freqInput" />
<input type="submit" value="Set frequency" />
</form>
</div>
<script type="text/javascript">
webPdLali.init()
$('form').submit(function(event) {
event.preventDefault()
Pd.send('freq', [parseFloat($('#freqInput').val())])
})
var patch
$.get('pd/main.pd', function(mainStr) {
// Loading the patch
patch = Pd.loadPatch(mainStr)
webPdLali.patchLoaded(mainStr)
})
</script>
</body>
</html>