Im newbie in JS so please bear with me.
I have a JS variable that i got from web service (JSON type). I tried to alert this variable and its working, returning 1 (integer) :
alert(result[0].totalMall);
I want to add a string to this variable so it will become like (for example) : 1 mall(s)
This is my code :
var result = result[0].totalMall.toString() + "Mall(s)";
alert(result);
$('.totalMall', this).html(result);
But the alert above always returning undefined. What should i do? I have been working for hours to just fix this.
And the result always displaying just "mall(s)" without the integer (result[0].totalMall.toString()) with it.
Any help is appreciated. Thanks :D
result. Tryvar res = result[0].totalMall.toString() + "Mall(s)";, and see if that's any better. (Thenalert(res)etc, of course.)resultvariable (though it doesn't affect the code you've posted)..toString()sum of integer and string always returns string :)