[eluser]Zeeshan Rasool[/eluser]
If your just want to get base url or any specific url and want to use it in js files where you are doing ajax calls then, declare a JS variable at header section of your main.php or index file and assign your value to it.
<html>
<head>
var my_url = '<?=base_url?>/site/';
</head>
...
...