There a simple solution to that. JAvaScript supports closures, meaning you can use variables from outside the function scope inside the function value you pass to $.get as a callback (and everywhere else where you pass a function value)
var mypathToTheFile = path + '/' + fileToOperate;
var jqxhr = $.get(mypathToTheFile,
function(data, textStatus){
// here you simply use the mypathToTheFile variable!
});
There are some oddities to be aware of when you use closures. Anychanges to the variable outside the function scope will be reflected inside the function. E.g
var functionValues = [],i,j;
for(i=0;i<10;i+=1){
j = new String(i);
functionValues[i] = function(){alert(j);};
}
for(i=0;i<10;i+=1){
functionValues[i](); //this will alert 9 every time
}
will alert 9 10 times and not as you might expect 0,1,2,3,4,5,6,7,8,9
XMLHTTPRequestobject: api.jquery.com/jQuery.get/#jqxhr-object