Re: Submit data to cakephp controller via ajax
Use following syntax:
<script language="javascript">
$(document).ready(function(){
$('.delete').click(function(){
var device_id = $(this).attr('id');
if(confirm('Are you sure you want to delete this?')){
$.ajax({
type : "POST",
url : '/cslab/admin/devices/delete/', //controller action url
dataType: 'json',
data : {'device_id ' : device_id , 'key' : value},//Pass all submitted variables like that
success : function(data){
if(data.result) {
alert(data.message);
window.location.replace("/cslab/admin/devices/list");
}
else
alert(data.error);
}
});
}
});
});
</script>
On Sun, Aug 12, 2012 at 5:30 AM, Mr. Manager <lydara9@gmail.com> wrote:
Dear All,
I want to submit data to function of item controller and the view that I will be using is on invoice.
I hope that anyone can help me.
Best Regard,
Mr. Manager,
--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
--
Shiv Shankar
--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home