can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r19197: OPSC-344: handle json answer from endopi...

Committer: dpetrov
OPSC-344: handle json answer from endopint
U   trunk/htdocs/js/livejournal.js
Modified: trunk/htdocs/js/livejournal.js
===================================================================
--- trunk/htdocs/js/livejournal.js	2011-06-02 07:05:47 UTC (rev 19196)
+++ trunk/htdocs/js/livejournal.js	2011-06-02 07:21:20 UTC (rev 19197)
@@ -81,6 +81,7 @@
 LiveJournal.updateWalletBalance = function () {
 	jQuery.get( LiveJournal.getAjaxUrl( 'get_balance' ), function( resp ) {
 			if (! resp || resp.status != 'OK') return;
+			var newBalance = resp.balance ? parseInt( resp.balance, 10 ) : 0;
 
 			var balance = $("LJ_Wallet_Balance");
 			if( balance ) {
@@ -92,11 +93,10 @@
 			} else {
 				var balance = $("LJ_Wallet_Balance_Controlstrip");
 				if( balance ) {
-					balance.innerHTML = resp.balance ? resp.balance  : "0";
+					balance.innerHTML = newBalance;
 				}
 			}
-		}
-	);
+		}, 'json' );
 };
 
 // Placeholder onclick event

Tags: can3p, js, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments