Skip to main content
added 3 characters in body; edited tags
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

I'm doing a web sitewebsite in CodeIgniter and I'm loading the content page via jQuery, but I don't know if this is a good practice or not. Could I improve it?

jQuery:

// Another question here: how can I group the repeated code in a function:

// Another question here: how can I group the repeated code in a function:

$(function() {

var control = '../Indoamericana/Intranet/index/Proceso/';

var loadPage = function(page){
    $(".page-content").load(page);  
};

$("#gestion_directiva").click(function(event) {
    var process = 1;
    loadPage(control + process);
});

$("#gestion_calidad").click(function(event) {
    var process = 2;
    loadPage(control + process);
});

$("#gestion_academica").click(function(event) {
    var process = 3;
    loadPage(control + process);
});

I'm doing a web site in CodeIgniter and I'm loading the content page via jQuery, but I don't know if this is a good practice or not. Could I improve it?

jQuery:

// Another question here: how can I group the repeated code in a function:

$(function() {

var control = '../Indoamericana/Intranet/index/Proceso/';

var loadPage = function(page){
    $(".page-content").load(page);  
};

$("#gestion_directiva").click(function(event) {
    var process = 1;
    loadPage(control + process);
});

$("#gestion_calidad").click(function(event) {
    var process = 2;
    loadPage(control + process);
});

$("#gestion_academica").click(function(event) {
    var process = 3;
    loadPage(control + process);
});

I'm doing a website in CodeIgniter and I'm loading the content page via jQuery, but I don't know if this is a good practice or not. Could I improve it?

jQuery:

// Another question here: how can I group the repeated code in a function:

$(function() {

var control = '../Indoamericana/Intranet/index/Proceso/';

var loadPage = function(page){
    $(".page-content").load(page);  
};

$("#gestion_directiva").click(function(event) {
    var process = 1;
    loadPage(control + process);
});

$("#gestion_calidad").click(function(event) {
    var process = 2;
    loadPage(control + process);
});

$("#gestion_academica").click(function(event) {
    var process = 3;
    loadPage(control + process);
});
deleted 24 characters in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Codeigniter: loading Loading content in page via jQuery

Hi I'm doing a web site in codeigniterCodeIgniter and I'm loading the content page via jQuery, but I don't know if this is a good practice or not. Could I improve it? Thanks.

jQueryjQuery:

// Another question here,: how can I group the repeated code in a function:

Controller:Controller:

ViewView:

Thanks four your help.

Codeigniter: loading content in page via jQuery

Hi I'm doing a web site in codeigniter and I'm loading the content page via jQuery, but I don't know if this is a good practice or not. Could I improve it? Thanks.

jQuery

// Another question here, how can I group the repeated code in a function:

Controller:

View

Thanks four your help.

Loading content in page via jQuery

I'm doing a web site in CodeIgniter and I'm loading the content page via jQuery, but I don't know if this is a good practice or not. Could I improve it?

jQuery:

// Another question here: how can I group the repeated code in a function:

Controller:

View:

Post Migrated Here from stackoverflow.com (revisions)
Source Link
user3077706
  • 199
  • 4
  • 11

Codeigniter: loading content in page via jQuery

Hi I'm doing a web site in codeigniter and I'm loading the content page via jQuery, but I don't know if this is a good practice or not. Could I improve it? Thanks.

jQuery

// Another question here, how can I group the repeated code in a function:

$(function() {

var control = '../Indoamericana/Intranet/index/Proceso/';

var loadPage = function(page){
    $(".page-content").load(page);  
};

$("#gestion_directiva").click(function(event) {
    var process = 1;
    loadPage(control + process);
});

$("#gestion_calidad").click(function(event) {
    var process = 2;
    loadPage(control + process);
});

$("#gestion_academica").click(function(event) {
    var process = 3;
    loadPage(control + process);
});

Controller:

/**
* index();
* 
* funcion que carga la información del proceso en la intranet
* @param String $process Identificador del proceso a cargar
* @return Vista del proceso indicado
*/

public function index($process, $idProcess){        

    $data['data'] = $this->intranet_model->getProcessInfo($idProcess);
    $data['member'] = $this->intranet_model->getMembers($idProcess);
    $data['proceso'] = 'GI7';

    $route = '/Modules/Intranet/';
    $route .= $process;
    
    $this->load->view($route, $data);       
}

View

<div class="row">
    <div class="col-md-12">
        <h3 class="page-title">
            <?php foreach ($data as $row): ?>
            <?php echo $row->name ?>
            <?php endforeach ?>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="icon-home"></i>
                <a href="index.html">Página Principal</a> 
                <i class="icon-angle-right"></i>
            </li>
            <li>
                <a href="#">Intranet</a>
                <i class="icon-angle-right"></i>
            </li>
            <li>
                <a href="#"> 
                    <?php foreach ($data as $row): ?>
                    <?php echo $row->name ?>
                    <?php endforeach ?>
                </a>
            </li>
        </ul>
    </div> 
</div>

Thanks four your help.