konto usunięte
Temat: Usuwanie przez AJAX'a, dziwny problem :/
witampróbuję sobie usuwać ajax'owo i nie chce to działać
kod w widoku:
<div id="locations_table">
<table>
<tr>
<th>Nazwa</th><th>Uczelnie</th><th></th><th></th>
</tr>
<?php foreach ($locations as $location): ?>
<tr>
<td><?=$location['Location']['name'];?></td>
<td><?=$location['Location']['colleges_count'];?></td>
<td><span class="ui-icon ui-icon-tag"></span></td>
<td>
<?=$ajax->link('Usuń',
array('controller'=>'locations',
'action'=>'ajax_delete',
$location['Location']['id']),
array('update'=>'locations_table'));?>
</td>
</tr>
<? endforeach;?>
</table>
</div>
kod w kontrolerze:
function ajax_delete() {
// usunięcie i update $locations
if(!empty($this->pass[0])) {
// czy przekazany argument id /locations/ajax_delete/(id)
$loc_id = $this->pass[0];
$secure_count = $this->Location->College->find('count',array('conditions'=>array('location_id'=>$loc_id)));
if($secure_count==0) {
// jeśli do danego miasta nie jest przypisana żadna uczelnia (College)
if($this->Location->delete($loc_id)) {
$locations = $this->Location->find('all',array('order'=>'Location.name asc'));
$this->set(compact('locations'));
$this->render('ajax_delete_success', 'ajax');
}
else {
$locations = $this->Location->find('all',array('order'=>'Location.name asc'));
$this->set(compact('locations'));
$this->render('ajax_delete_failure', 'ajax');
}
}
else {
$locations = $this->Location->find('all',array('order'=>'Location.name asc'));
$this->set(compact('locations'));
$this->render('ajax_delete_secure', 'ajax');
}
}
}
I zwraca mi taki syf...
Missing View
Error: The view for LocationsController::ajax_delete() was not found.
Error: Confirm you have created the file: D:\Marek\xampp\htdocs\app\views\locations\ajax_delete.ctp
Notice: If you want to customize this error message, create app\views\errors\missing_view.ctp