使用控制台从codeigniter中执行javascript

I want to execute a dom ready javascript function from within codeigniter, I know how to do it -regular and usual way- using a view, but now I need to do it using the console, as when you usually run a php index.php controller method parameter_A parameter_B... from the console, my javascript function itself contains an ajax function as part of its definition, i.e.

<script type="text/javascript">
    $(document).ready(function() {
    function envia_mail_ajax(numero, form_data,ruta){   
    var iddiv="#mail_"+numero;
    window.setTimeout( 
    function(){
    $.ajax({
        url: "<?php echo site_url('emailmasivo'); ?>/" +ruta+ "/" +numero, 
        cache: false,
        type: 'POST',
        data: form_data,
        dataType: "json",
        success: function(html){
            $( iddiv ).append(html.mensaje+"
"+'<br />');
        }   
    });
}, 600);    
}
    var hola="hola";
    var cuenta_id=<?php echo $id_cuenta; ?>;

    <?php 
        echo $lista_mails;
    ?>

    if( correos_e.length==0)
        window.close();
    j=0;
    for (i=<?php    echo $ini;  ?>; i<(correos_e.length);i++){
        if ( correos_e[i] != undefined ){
            j=j+1;
            str_tmp = '<div id="mail_'+i+'">'+correos_e[i]+
                    '<img src="<?php echo base_url();?>images/ajax-loader.gif"  />'+'</div>'+"
";
            console.log(str_tmp);
            $('#resultado_envio').append( str_tmp );
            envia_mail_ajax(i,
    {para:correos_e[i],id_masivos:id_masivos_e[i],id_mat_referencia:id_mat_referencia_e[i],
            id_tipouser:id_tipouser_e[i],nombre:nombres_e[i], sexo:sexos_e[i], matricula:matriculas_e[i], passa:passa_e[i],id_cuenta:cuenta_id},
                "<?php echo $r_ajax; ?>");              
        }
    }
});
</script>

as you can see, there´s no problem in using a view (this code is located in a view!), but, how can make the javascript run when using the console to run the whole program using the same controller, method and parameters used in the browser-view version? thanx i.a.

douchuitang0331
douchuitang0331 否则,为了从终端运行我的程序,我怎么能克服这个“障碍”呢?
5 年多之前 回复
dsdtszi0520538
dsdtszi0520538 nop,*nix,linux,OSX盒子中常用的系统控制台/终端。
5 年多之前 回复
duanchui1955
duanchui1955 嗯..你指的是什么控制台,浏览器的开发者工具控制台?
5 年多之前 回复
douou8954
douou8954 是的,你不能从命令行界面调用HTML/JS视图文件,它只会将批量输出为文本
5 年多之前 回复
doy2255
doy2255 你不能。当您在命令行运行PHP时,没有JS引擎。
5 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问