Zend and jQuery $.ajax() callback not working -


zend , jquery $.ajax() callback not working

i can make $.ajax() work on web page, input boxes, filled query php program, can't make work using same function, valid zend action (either zend-like url or using fqdn url)

server side

$.ajax() in zend

i have action i'm working, because accessing following url

       http://my_site/my_controller/my_action/some_id/some_number  

i web page json encoded record, because within my_action have call query follows ...


$this->_helper->layout->disablelayout();  //disable "zend automatic behavior" $this->_helper->viewrenderer->setnorender();  $my_resulting_row = $my_model->my_query( $this->_getparam('some_id') ); $my_json = zend_json::encode($my_resulting_row); echo $my_json; 

as expected, probes query working, , encoding working

client side

i have working javascript function following

function my_work( any_id ) {     // alert(any_id);    // working ok   $( function() {    // window.opener.document.getelementsbytagname('input')[0].value = any_id; // ok 

// problem: // next line in javascript call $.ajax(), aim 1) call query database using code "any_id", packed in json format 2) receive obtained data 3) decode data, write data each input box on calling page

$.ajax({ type:'get',   // default, no need put here          url:'/my_controller/my_action/any_id',   // action (showed above)         data:any_id,        // in case ... not working either way     datatype:'json',        // supposed "unpack" data   beforesend: function(){ alert('here ok'); }, //this ok       success:function( rows )  {    // not alert opens here      for( var in rows ) {        var row = rows[i];          // statements put data in web page          window.opener.document.getelementbyid('ia3').value=row[5];          // not alert works here (mean within success parameter)         }//for loop        },      error:function(){ alert('error'); },  // not working     complete: ... not popping alert()... 

the above function working, tested in separated experimental page somewhere else (mean not in zend) tried window.opener.document.getelementbyid('ia3').value=row[5]; , works, outside zend framework. had added init() in controller declare ajaxcontext, indicated in examples. , changed view file suffix ajax.phtml, zend doesn't see such file if change suffix (either call controller/action using javascript or url(), changed was.

in brief: can make $.ajax() callback work on web page, input boxes, filled query separate php file, can't make work using same javascript function $.ajax() callback, zend action (that, said, know working ok.)

any clue solution ?

thanks !


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -