Good day.

I want to have a button to delete a field in the database.

I'm trying to return the date only for debugging, it goes right after I do 
the action to delete the database.


My AtividadesController is declared with the delete function as below:

class AtividadesController extends AppController {
>     public function delete(){
>         $this->layout = 'ajax';
>         $this->set('delete', date('d/m/Y'));
>     }
> }
>


The delete view looks like:

<?php
    echo json_encode(array('success' => true, 'html' => $delete));

> ?> 



 
In the index view I have to delete the button and the div to receive the 
message:

<div id="msg"></div>;
> <td><button id="btn">Excluir</button></td>;




In'm calling my default file. Js:

echo $this->Html->script('myajax');




And finally my myajax.js, which is in the folder webroot / js:

$(document).ready(function(){
$("#btn").click(function(){
$.get(
"atividades/delete/",
null,
function(data){
var retorno = jQuery.parseJSON(data);
if(retorno.success){
$("#msg").html(retorno.html);
}
}
);
});

> }); 




Anyway, I click the delete button and nothing happens.

I thank anyone who can help.

Hug.
Rafael.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to