How to get current server time in javascript with Indian standard timezone?
Asked
Active
Viewed 79 times
-1
-
2The first step would be to tell your server to run PHP in these files. Naming them `.js.php` should suffice. – John Dvorak Apr 16 '16 at 10:00
-
We can move to .js.php file. So it will give proper response. But don't forget to respond with proper header else it will be treated as text. You need to respond with content-type: application/json – rajesh Apr 16 '16 at 10:06
1 Answers
1
you simply put a
<script>
var baseJSURI = '<?php echo base_url(); ?>';
</script>
somewhere on your page, so you can use it elsewhere in external JS.

theCodeSurgeon
- 460
- 2
- 9
-
That doesn't work if you don't want this variable to be visible everywhere (and thus subject to name collisions) – John Dvorak Apr 16 '16 at 10:01
-
if I understood correctly the question, there can be a single baseurl, why should someone experience name collisions about this? if so, simply change the variable name. – theCodeSurgeon Apr 16 '16 at 10:04