[eluser]bhakti.thakkar[/eluser]
HI all,
I am new to jquery. I am implementing it in my CI application. I have downloaded the latest jQuery JavaScript Library v1.3.2. I got a simple example on the internet and i think of starting with the same. Below is the code in the view page
Code:
[removed]
$(document).ready(function() {
$('#submit').click(function() {
var msg = $('#message').val();
alert(msg);
$.post("<?=site_url('certificates/AJAXUpdateDB') ?>", {message: msg}, function() {
$('#message').val('');
});
});
});
[removed]
I need to know two things of the bold line:
in the line site_url('message/add') -- i learn that message is a controller and add is a function in it that will execute lines of code. But i dont get the text i.e {message: msg}. if in this case it is the control name(id to be specific) and msg is the value, then how will i pass radio button?
and the second doubt is whether i should use site_url or base_url?
Controller
certificates.php
Code:
function AJAXUpdateDB() {
print "here";
$msg = $_POST['message'];
$stmt="update TransactionCertificate_T set InvoiceReference_VC = '$msg' where TransactionCertificate_ID = '$TransactionCertificate_ID'";
$this->db->query($stmt);
return;
}
when i call this, nothing happens.
Where am i wrong