I'm struggling with this and just can't seem to make it work.
Need to pass the current users date (cdate) variable to my controller and in spite my alert windows shows the correct value, that value never reaches the controller.
Here's the javascript code:
$(document).ready(function() {
$('#submit').click(function() {
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()+1
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
if (month<10)
month="0"+month
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var cdate=+month+"/"+daym+"/"+year
$.post('user/available', {curdate: cdate});
alert(cdate);
});
});
Controller:
$curdate=$this->input->post('curdate');
View:
echo form_open('user/available');
Can anyone tell me what i'm doing wrong?
echo form_input('dateav','',$dateav);
input type="image" src="echo base_url();images/send.png" id="submit" alt="Submit button"
echo form_close();
Thanks