[eluser]Uplift[/eluser]
I'm trying to submit a form with jQuery, it's showing the success function but it's not updating the database. I'm quite new to jQuery so i may have slightly missed something or wrong syntax or something. Can anyone see ?
Code:
$('#submit').click(function() {
var newstyle = $('input[name=choosetheme]:checked').val();
$.ajax({
url: 'http://www.website.net/ubuzz/theme/update',
type: 'POST',
data: "newstyle="+ newstyle,
success: function() {
$('div.success').fadeIn();
}
});
return false;
});
// Theme controller
function update() {
$data = $this->data_model->getSiteData();
$userid = $data['userid'];
$newstyle = $this->input->post('choosetheme'); // grab data from radio box
$data = array('styleid' => $newstyle); // inserting the value of $newstyle to 'styleid' cell
$this->forumdb->where('userid', $userid);
$this->forumdb->update('user', $data);
}
input[name=choosetheme]:checked
should return the checked radio box within the choosetheme name?
any suggestions