1
<!doctype html>
2
<head>
3
  <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
4
  <script type="text/javascript">
5
    $.getJSON("http://127.0.0.1:5000/feed", function(data)
6
    {
7
    d = $.makeArray(data);
8
    d.reverse();
9
    str = "";
10
    console.log(d[0]);
11
    $.each(data, function(i, val)
12
    {
13
      if(val['about'] != undefined && val['about'] != 'undefined' && val['author'] != 'undefined' )
14
      str += "<p>\n<b>@" +val['author']+"</b> has narrated <b>"+val['about']+"#"+val['xpath']+"</b> at <b>"+val['blog']+"#"+val['bxpath']+"</b> for <b>"+val['location']+"</b> in <b>"+val['lang']+"</b>\n</p>";
15
    });
16
    $("#feeds").html(str);
17
    });
18
  </script>
19
</head>
20
<body style="text-wrap:normal">
21
    @<input type="text" id="t1" name="author" value="author" /> says <input type="text" id="t2" name="about" value="about" />  <input type="text" id="t3" name="xpath" value="xpath" /> has <select id="selected" ><option>re-narrations</option><option>comment</option></select> at <input type="text" id="t4" name="blog" value="blog" /> <input type="text" id="t5" name="bxpath" value="bxpath" /> in <input type="text" name="lang" value="language" id="t6" /> targetting <input type="text" name="loc" value="location" id="t7"/>  <input type="submit" id="post" name="alipi" value="Feed" onclick="postForm();" />
22
<div id="feeds">
23
</div>
24
<script type="text/javascript">
25
   function postForm()
26
  {
27
   var arr = {};
28
   arr['author'] = $('#t1').val();
29
   arr['about'] = $('#t2').val();
30
   arr['xpath'] = $('#t3').val();
31
   arr['blog'] = $('#t4').val();
32
   arr['bxpath'] = $('#t5').val();
33
   arr['type'] = $("#selected").val();
34
   arr['lang'] = $('#t6').val();
35
   arr['location'] = $('#t7').val();
36
  $.post("http://127.0.0.1:5000/feeds/write", arr, function(data)
37
  {
38
  alert("Posted");
39
  });
40
}
41
function checkVal(){
42
    if($("#selected").val() == "comment")
43
	$("#post").hide();
44
    else
45
	$("#post").show();
46
}
47
48
</script>
49
</body>
50
</html>