function update_tracks() { $trackid = $this->input->post('trackid'); $albumid = $this->input->post('albumid'); $next_trackid = $this->input->post('next_trackid'); $next_albumid = $this->input->post('next_albumid'); $playlistid = $this->input->post('playlistid'); $result = array("error" => FALSE); if ($next_trackid == "" || $next_albumid == "") { $next_trackid = NULL; $next_albumid = NULL; } try { if (!Playlist::updateTracks($trackid, $albumid, $next_trackid, $next_albumid, $playlistid)) { $result['error'] = TRUE; } } catch (Exception $e) { $result['error'] = $e->getMessage(); } echo json_encode($result); }