Chrome Download Old Javascript File

I am building a web application using CodeIgniter.

The problem I ran into is that chrome is loading an older version of my javascript main.js file

My code is:

$(document).load(function(){

/******************************************
*                                         *
*              AJAX FUNCTIONS             *
*                                         *
******************************************/    

function deactivate_dept_member(user_id, token_name, token_hash, callback)
{
    $.post(
        site_url('/ajax/deactivate_dept_member'),
        {
            'user_id':usr_id,
            token_name:token_hash
        },

        function(result){
            var response = jQuery.parseJSON(result);
            callback(response);
        }
    );
}

function activate_dept_member(usr_id, token_name, token_hash, callback)
{
    $.post(
        site_url('/ajax/activate_dept_member'),
        {
            'user_id':usr_id,
            token_name:token_hash
        },

        function(result){
            var response = jQuery.parseJSON(result);
            callback(response);
        }
    );
}

function get_dept_users_for_session(dept_id, token_name, token_hash, callback)
{
    $.post(
        site_url('ajax/get_dept_users_for_session'),
        {
            "dept_id":dept_id,
            token_name:token_hash

        },

        function(result){
            var response = jQuery.parseJSON(result);
            callback(response);
        }
    );

}

function invite_dept_user(email_address, first_name, last_name, admin, token_name, token_hash, callback)
{
    $.post(
        site_url('ajax/invite_dept_user'),
        {
            "email_address":email_address,
            "first_name":first_name,
            "last_name":last_name,
            "admin":admin,
            token_name:token_hash
        },
        function(result){
            var response = jQuery.parseJSON(result);
            callback(response);
        }
    );
}

function get_department_members(dept_id, token_name, token_hash, callback)
{
    $.post(
        site_url('ajax/det_department_members'),
        {
            "dept_id":dept_id,
            token_name:token_hash
        },
        function(result){
            var response = jQuery.parseJSON(result);
            callback(response);
        }
    );
}




/******************************************
*                                         *
*              UTILITY FUNCTIONS          *
*                                         *
******************************************/
function site_url(add_on)
{
    return 'http://localhost:8080/app/index.php'+add_on;
}

function getUserTypeString(user_status)
{
    switch(user_status)
    {
        case "1":
            return "Invited";
        case "2":
            return "Active";
        case "3":
            return "Inactive";
        default:
            return "";
    }
}


function isDepartmentAdmin(user_role)
{
    if(user_role == 2){
        return true;
    }
    return false;
}

function get_error_message(error_code)
{
    switch(error_code)
    {
        case "20130":
            return 'The username already exists';
        default:
            return 'A general error occured';
    }
}


})

What is Chrome: My source:

/******************************************
*                                         *
*              AJAX FUNCTIONS             *
*                                         *
******************************************/    

function deactivate_dept_member(user_id, token_name, token_hash, callback)
{
    $.post(
        site_url('/ajax/deactivate_dept_member'),
        {
            'user_id':usr_id,
            token_name:token_hash
        },

        function(result){
            var response = jQuery.parseJSON(result);
            callback(response);
        }
    );
}

function activate_dept_member(usr_id, token_name, token_hash, callback)
{
    $.post(
        site_url('/ajax/activate_dept_member'),
        {
            'user_id':usr_id,
            token_name:token_hash
        },

        function(result){
            var response = jQuery.parseJSON(result);
            callback(response);
        }
    );
}

function get_dept_users_for_session(dept_id, token_name, token_hash, callback)
{
    $.post(
        site_url('ajax/get_dept_users_for_session'),
        {
            "dept_id":dept_id,
            token_name:token_hash

        },

        function(result){
            var response = jQuery.parseJSON(result);
            callback(response);
        }
    );

}

public function invite_dept_user(email_address, first_name, last_name, admin, token_name, token_hash, callback)
{
    $.post(
        site_url('ajax/invite_dept_user'),
        {
            "email_address":email_address,
            "first_name":first_name,
            "last_name":last_name,
            "admin":admin,
            token_name:token_hash
        },
        function(result){
            var response = jQuery.parseJSON(result);
            callback(response);
        }
    );
}

public function get_department_members(dept_id, token_name, token_hash, callback)
{
    $.post(
        site_url('ajax/det_department_members'),
        {
            "dept_id":dept_id,
            token_name:token_hash
        },
        function(result){
            var response = jQuery.parseJSON(result);
            callback(response);
        }
    );
}




/******************************************
*                                         *
*              UTILITY FUNCTIONS          *
*                                         *
******************************************/
function site_url(add_on)
{
    return 'http://localhost:8080/app/index.php'+add_on;
}

function getUserTypeString(user_status)
{
    switch(user_status)
    {
        case "1":
            return "Invited";
        case "2":
            return "Active";
        case "3":
            return "Inactive";
        default:
            return "";
    }
}

function isDepartmentAdmin(user_role)
{
    if(user_role == 2){
        return true;
    }
    return false;
}

function get_error_message(error_code)
{
    switch(error_code)
    {
        case "20130":
            return 'The username already exists';
        default:
            return 'A general error occured';
    }
}


                  

Things I decided to try and fix the problem

  • Disabled cache using Chrome Developer Tools
  • Using the extension / LiveReload application
  • Restart apache
  • Checked that sharing for Vagrant works correctly (the same file in the virtual centos instance that I have running, as on my Mac)
  • I tried to get chrome to load a different version of the file (adding? 2 to the end of the file URL to the file: localhost: 8080 / app / assets / js / main.js? 2)

Other notes:

  • Firefox Safari, Apache, , oci8 php .

Edit:

,

  • ( , ).
+5
1

, , - (, , " " ), (, BOM, CR ..).

, , " ", " , , , ".

, , , rogue CR EOF: ( ) / , .

CR , " " ( LF rogue CR) , / . , .

UPDATE: , "" UTF-8 ( ), . - :

Visual Studio 2008 -

... , , , UTF8 , , Chrome .

, :

            return 'A general error occurred';
        }
    }
})
/* END OF FILE */

. . "", - .

+2

All Articles