phpjavascriptdirname

Equivalent of PHP's dirname(__FILE__) in JavaScript?


as I already mentioned in the title, I'm looking for a JS-function for getting the same result like I get with this PHP code:

dirname(dirname(__FILE__))

Thanks in advance!


Solution

  • I don't think it is possible because php dirname operates on apache server on local machine. It has access to the filesystem. But javascript operates on browser layer which can't operate with filesystem. I think so you should use ajax and proccess result how you need it. I think so its best solution for you.