Created
December 15, 2012 08:17
-
-
Save atree/4292100 to your computer and use it in GitHub Desktop.
I always forget how to create javascript singleton objects.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj_ea = new function() { | |
this.url = 'some_ajax_url.php'; | |
this.submit_actions = function() { | |
var data = { | |
'id': 'e04b7291', | |
'email': $('#email1').val(), | |
'status': $('#status1').val(), | |
'email_pre_cust': $('#email4').attr('checked'), | |
'email_pre_fire': $('#email5').attr('checked'), | |
'email_approved': $('#email3').attr('checked'), | |
'email_denied' : $('#email2').attr('checked'), | |
'expired_date' : $('#expiration').attr('checked')}; | |
$.ajax({ | |
url:this.url, | |
type:'POST', | |
data:data, | |
success: function(response) { rep = JSON.parse(response); if (rep.RELOAD) {location.reload();} } | |
}); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment