Welcome Guest, Not a member yet? Register   Sign In
jQuery and CI together
#1

[eluser]Unknown[/eluser]
I hope im on the right place.

I have created the MVC files, and a helper file to load the jquery libraries,

however, when i try to display my view, nothing happens,

what could possibly missing, do i have to configure something,? does jquery doesn’t work exactly as it was when your doing plain html,

what i am just trying to accomplish is to display a timer, i already have the function timer, however, when i try to load it, nothing happen, nothing is displayed,

timer.js
Code:
function formatTime() {
    now = new Date();
    hour = now.getHours();
    min = now.getMinutes();
    sec = now.getSeconds();
  
    if (min <= 9) {
        min = "0" + min;
    }
    if (sec <= 9) {
        sec = "0" + sec;
    }
    if (hour > 12) {
        hour = hour - 12;
        add = " PM";
    } else {
        hour = hour;
        add = " AM";
    }
    if (hour == 12) {
        add = " PM";
    }
    if (hour == 00) {
        hour = "12";
    }
    
    var ttime=((hour<=9) ? "0" + hour : hour) + ":" + min + ":" + sec + add;
    setTimeout("formatTime()", 1000);
    $("#divHeader").html(ttime);
}
on the load of view.php
Code:
$(window).load(formatTime());
i tried everything, like just putting the same code in the view.php, putting it outside an external js file, im almost buried here… any help or insights is appreciated,

Thanks,




Theme © iAndrew 2016 - Forum software by © MyBB