Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Constructor
- function ShoutBox() {
- this.div = $('#shout');
- this.form = $('#formy');
- this.form.bind("submit", this.new_submit, false);
- eval('box = this');
- };
- // =======ShoutBox Class=======
- ShoutBox.prototype = {
- new_submit: function() {
- $.ajax({ type: "POST", url: "/", data: $(self.form).serialize()+'&format=js', dataType: "html", success: function(data){ box.update_div(data); } });
- return false;
- },
- refresh: function() {
- $.ajax({ type: "GET", url: "/", success: function(data){ box.update_div(data); } });
- },
- update_div: function(data) {
- this.div.html(data);
- }
- };
- // ==========End ShoutBox==================
- $(document).ready(function() {
- new ShoutBox();
- });
Add Comment
Please, Sign In to add comment