Cómo llamar a una función ajax antes de cargar cualquier página de vista particular en Codeigniter

I have a view page below which automatically detects the current user timezone and after detecting timezone , i am sending it to another page for setting the timezone in session for further use.

here is the file(autodetect.php)

<!DOCTYPE html>
    <script type="text/javascript" src="....jquery.js' ?>"></script>  
      <script type="text/javascript"       src='..autodetect/Jsfile/detect1.0.4.min.js'>   
 $(function() {   

   <?php if (!isset($_SESSION['tz'])) { ?>
        var timezone = jstz.determine(); 
            type: "POST",
            url:"<?php echo base_url('timezone.php'); ?>",
            data: 'timezone='+timezone.name(),
            success: function(data){ 
        <?php } ?>   

,in order to perform this functionality i have to load/read this page(autodetect.php) first,

entonces mi pregunta es "how can i run this page(i.e autodetect.php) before loading any view page or calling any view page via controller?

eg. i have to load the signup page , but before then this i need to read the above php file in order to detect the current timezone of user.

preguntado el 09 de septiembre de 13 a las 23:09

Hi All! If my above question is not clear, please write comment for me, so that i will try to explain you in a different way. Thanks -

Apparently, this has been answered here: stackoverflow.com/questions/13/… -

@Ponce That is not similar with my problem. I am asking a diffrent thing -

1 Respuestas

To load any script before loading any view page, you can use Hooks:

Hooks: ampliación del núcleo del marco

And choose the appropriate punto de gancho para su necesidad

Respondido el 12 de Septiembre de 13 a las 19:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.