codeigniter - Code igniter and jquery $.post() -
i using jquery $.post() , updating value in database using cod igniter. now, how send result success call in jquery.
this what, have tired.
model
class test extends ci_model{ function update(){ ..... return $result = $this->db->update(); } }
jquery
$.post(...,... , function(data,status) { alert(data); **says undefined** alert(status); **says success** });
since using update update value in database, passing array controller model.now when use mentioned in controller, missing argument 1 update() function makes sense, how result of model controller ?
just echo
variable. received in jquery. try this,
controller :
function index(){ if($a = $this->test_model->update()){ $data['rows'] = $a; } echo json_encode($data); }
Comments
Post a Comment