concatination in JS failing
hey guys i have the following code to dynamically change the content in a div :
- var pg_prefix = 0;
-
- $('#next').on('click' , function(){
- pg_prefix++;
- if (pg_prefix >= 2) {
- var pg_prefix = '';
- }
- console.log('brands' + '-' + pg_prefix); // if console.logged , this give me "brands-NaN"
- // instead of "brands-1" or "brands-2"
- $('#brands').load('brands' + '-' + pg_prefix);
- });
my problem is my concatination is't working :
'brands' + '-' + pg_prefix
i get the following results instead of what i want . what can i do to correct this ?
- if console.logged , this give me "brands-NaN"
- // instead of "brands-1" or "brands-2"
Thank you.
Gautam.