Initial commit
[2ch-be.git] / dev-test / new / js / script.js
blob93a92c07253bdb6f6262d5fb309963f2f860e53a
1 $(document).ready(function(){
3                 $('#sendMessage').validate({
4             rules: {
5               subj: {
6                 required: true
7               },
8               msg: {
9                 required: true,
10               }
11             },
12                         highlight: function(element) {
13                                 $(element)
14                                 .closest('.form-group').addClass('has-error').removeClass('has-success');
15                         },
16                         success: function(element) {
17                                 element
18                                 .closest('.form-group').removeClass('has-error').addClass('has-success');
19                         }
20           });
22           // $('#sendMessage').validate();
23           var load = 0;
24           $('#page').scroll(function(){
25               var r = $('#page')[0].scrollHeight- $('#page').height();
26               //alert($('#page').scrollTop() + " and " + r);
28               if($('#page').scrollTop() == r){
30               load++;
31               //alert(load + "scroll detected" + "scrollHeight and page height: " + r);
32               //$.post("try.php", {load:load}, function( data ))
33               //$('#page').append( data );
35               $.post( "try.php", {load:load}, function( data ) {
36                             $( "#list" ).append( data );
37               });
38             }
39           });
41 });