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>
<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>


<button id="startButton">Start</button>

<div id="controls">
    <input type="text" id="freqInput" />
    <input type="submit" value="Set frequency" />

<script type="text/javascript">

  $('form').submit(function(event) {
    Pd.send('freq', [parseFloat($('#freqInput').val())])

  var patch
  $.get('pd/main.pd', function(mainStr) {
    // Loading the patch
    patch = Pd.loadPatch(mainStr)