Guest User

Untitled

a guest
Jun 23rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. // Constructor
  2. function ShoutBox() {
  3. this.div = $('#shout');
  4. this.form = $('#formy');
  5. this.form.bind("submit", this.new_submit, false);
  6. eval('box = this');
  7. };
  8.  
  9. // =======ShoutBox Class=======
  10. ShoutBox.prototype = {
  11. new_submit: function() {
  12. $.ajax({ type: "POST", url: "/", data: $(self.form).serialize()+'&format=js', dataType: "html", success: function(data){ box.update_div(data); } });
  13. return false;
  14. },
  15.  
  16. refresh: function() {
  17. $.ajax({ type: "GET", url: "/", success: function(data){ box.update_div(data); } });
  18. },
  19.  
  20. update_div: function(data) {
  21. this.div.html(data);
  22. }
  23.  
  24. };
  25. // ==========End ShoutBox==================
  26.  
  27. $(document).ready(function() {
  28. new ShoutBox();
  29. });
Add Comment
Please, Sign In to add comment