// JavaScript Document function jfSubscribeForm($path) { this.path = $path; this.email = $('#subscribe-email'); this.message = $('#subcribe-message'); var $self = this; $('#subscribe .button-submit').click(function(event){ $self.subscribe(); event.preventDefault(); }); $('#subscribe form').bind('submit', function(event){ $self.subscribe(); event.preventDefault(); }); this.email.keyup(function(event){ if (event.keyCode == '13') { $self.subscribe(); event.preventDefault(); } }); } jfSubscribeForm.prototype.subscribe = function() { var $self = this; var $request = 'jf_subscribe_email='; if(this.email.attr('alt') != this.email.val()) { $request = $request + this.email.val(); } $.ajax({ type: "POST", data: $request, cach: false, dataType: "json", url: this.path + "/subscribe.php", beforeSend: function(){ $('#subscribe').append('