CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   Cleaner Code - Pseudocode (http://www.codingforums.com/showthread.php?t=280284)

FowlerS47 11-01-2012 04:50 AM

Cleaner Code - Pseudocode
 
I am tinkering with this code snippet and trying to determine a cleaner better way to use my logic with javascript. I am relative beginner, so would appreciate any help.

<script>// JavaScript Document
var Alpha = function() {
this.itemOne = 1;
this.itemTwo = 2;

this.doSomething = function(withThis) {
$.post("/post/url", { data: withThis },
function(result) {
this.itemOne = result.resultOne;
this.itemTwo = result.resultTwo;
});
};
this.doSomethingElse = function(withThese) {
for (var i = 0; i < Things.length; i++) {
$.each(Things[i].subItems, function(subItem) {
};
};
$.post("/post/url2", { data: withThese.postData},this.postResponse);
};
};

Alpha.prototype.postResponse = function(data) {
this.doSomething(data);
};

</script>


All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.