![]() |
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.