John Cooper
John Cooper

Reputation: 7651

Giving dynamic names for file creating

url: '/folder/file' + i + '.js',

The above url creates file1.js, file2.js etc etc

I want the url to be : /foldename +file[i] + i + '.js'

Can i have an array file which would control the names of the file being created.

Upvotes: 0

Views: 80

Answers (1)

patapizza
patapizza

Reputation: 2398

Uh... Yeah, actually you can:

var file = Array();
file[0] = 'file';
file[1] = 'otherfilename';
/* ... */
var url = '/folder/' + file[j] + i + '.js';

Upvotes: 2

Related Questions