The bit that sends the data out on a button click:
$.ajax({
type: "POST",
url: "<?php echo base_url(); ?>coformation/appoint/",
data: {
"director":director.attr('checked'),
"shareholder":shareholder.attr('checked'),
"secretary":secretary.attr('checked'),
"firstname":firstname.attr('value'),
"lastname":lastname.attr('value'),
"birthday":birthday.attr('value'),
"birthmonth":birthmonth.attr('value'),
"birthyear":birthyear.attr('value'),
"occupation":occupation.attr('value'),
"nationality":nationality.attr('value'),
"security1":security1.attr('value'),
"securityletters1":securityletters1.attr('value'),
"security2":security2.attr('value'),
"securityletters2":securityletters2.attr('value'),
"security3":security3.attr('value'),
"securityletters3":securityletters3.attr('value'),
"residentialaddress":residentialaddr.text(),
"serviceaddress":serviceaddr.text()
},
success: function(response) {
alert(response.message);
},
dataType: "json"
});
But when i var_dump($_POST) in the target URL, it appears that this procedure sends out only 2 fields:
array (size=2) 'residentialaddress' => string 'XXX' (length=34) 'serviceaddress' => string '' (length=0)
What could be the problem?
you are posting attributes there attr()..please go throu the link to see what attr actually does..
you can even try doing
this send either true or false..
that should be
val() gives you the value of checked element if checkbox or radio .. text if textbox…. i think this is what you want