Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ...... The code is in CodeIgniter ...
Cron job is not executing my javascript in PHP view page ,when I am assigning controller function and on the same time i am calling View Page(contains Javascript code ) ,after cron job done javascript was not executing in View page please help out .

[edit]
Hi this is a function i am calling in cron job

PHP
public function connect()
{


$mail=$this->Reports_model_weekly->get_all_usermails();
$i=0;
foreach($mail as $email)
{
    $data=array();
    $data['company_name']=$email['company_name'];
    $data['company_id']=$email['id'];
    $user=$email['customer_name'];
    $email_id=$email['email_id'];
    $data['surveys']=$this->Reports_model_weekly->get_surveys($email['id']); 
    $data['locations']=$this->Reports_model_weekly->get_locations($email['id']); 
 $graph=$this->load->view('reports/reports_weekly_graphs',$data);


//    print("<div style='display: none;'>".print_r($graph)."</div>" );
    $pdf_data=$this->pdf_generate($email['id']);  
    /*print("<script>alert('<!--?php print_r($graph);?-->');</script>");*/


  $html=$this->load->view('reports/reports_weekly',$pdf_data,true);

/*    $filename=$data['company_name'];
	$this->load->library('pdf');
    $mpdf = $this->pdf->load(); 
$mpdf->WriteHTML($html);
$mpdf->Output($data['company_name'],'D');
*/
  
    $this->db->select('id');
$image1=$this->db->get('weekly_report_image_url')->result_array();
    
    foreach($image1 as $row)
        {
	$id1=$row['id'];
	$this->db->delete('weekly_report_image_url',array('id'=>$id1));
        }
    $this->load->library('email');
    $config = array();
                                        $config = $this->mail_config();
                                        $config['mailtype'] = "html";
                                        $this->email->initialize($config);
                                        $this->email->from('no-Reply@gmail.com');
                                        $this->email->to('xyz@abc.com');
                                        $this->email->subject("Weekly Report");
						
                                        $this->email->message($html);
                                      /*$filename=$email['company_name'];
                                         $this->load->library('pdf');
                                        $mpdf = $this->pdf->load(); 

                                 $mpdf->WriteHTML($html);
                                 //$mpdf->Output($pdfFilePath, 'F');
                                 $mpdf->Output($email['company_name'],'D');
                               */
                                      
				if($this->email->send())
				{
					$data['success'] ='<p class="email_sent">An email has been sent to you </p> 
                    
                    <p>If you have not received the email:</p> 
                    <ul>
                    <li >Please Try to look at it in your spam email box.</li>
                    <li>If it is still not found, you may try to submit the form again to resend it.</li>
                    <li >If the problem persists, please contact us on<a href="mailto:support@txt.com" style="text-decoration:none;"><span style="color:#25a8e0;"> support@txt.com<span></a></li>
                    </ul>';                        
                                                    
                              
                                            
                                            //print_r($data); exit;
				}
}

This function manually works without cron job ... when i assign this to cron job it wont work .. please help me
Posted
Updated 23-Sep-14 3:15am
v3
Comments
Richard MacCutchan 23-Sep-14 8:07am    
This is not a good question. No one can guess what may be happening on your system.
Richard MacCutchan 23-Sep-14 9:17am    
You need to collect more information, and please add it to the question. What is the code that runs this from cron, what results do you see?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900