jquery - Can't send value to my controller home.php using Ajax -


view page

this ajax code block.i have pass value income_date controller

       function incomedate(income_date)         {            // alert(income_date);              $.ajax({             type: "post",             url: "<?php echo base_url();?>home/submit_income",                        data: {income_date:income_date},             success: function(res1)              {             }             });          } 

i got income_date script

       var income_date=document.getelementbyid("dateval").value; 

function call here

       incomedate(income_date); 

controller home.php

       function submit_income()        {            $income_date=$this->input->post('income_date');       } 

instead of using this:

url: "<?php echo base_url();?>home/submit_income", 

use this:

url: "<?php echo site_url();?>home/submit_income", 

there high chances must have missed "index.php".(i missed lot of times @ beginning of career!!)

the base_url() return http://localhost/myproject. whereas site_url() return http://localhost/myproject/index.php

in codeigniter, known cause issues. try , kindly clarify further if issue else!!


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -