jquery - CAKEPHP find using a ajax request -
i want $this->find using id of ajax request.
i has 2 selects , want to, if choice 1 option return select related id.
this function:
if($this->request->is('ajax')) { $this->layout = false; $id = $this->request->data['select']; $this->set('filial',$this->branch->find('list', array('conditions' => array('company_id' => $id )))); } and ajax:
$(document).ready(function() { $("#attorneyempresa").change(function(){ $.ajax({ data: { select: $('#attorneyempresa').val()}, sucess: function(data) { }, complete: function() { alert(data); } }) }) }); i want execute action, data of find , fill select. how this?
you should in success callback:
$(document).ready(function() { $("#attorneyempresa").change(function(){ $.ajax({ data: { select: $('#attorneyempresa').val()}, success: function(data) { console.log(data); } }) }) });
Comments
Post a Comment