2013-11-15 6 views
0

ajax 호출을 시도하고 응답으로 응답을 얻으려면 phpfox. phpfox, ajax 호출의 응답으로 값 얻기

JS

:

$.ajaxCall('module.check_whether_first_time', 
'u_id='+u_id+'&my_user_id='+my_user_id).done(function(data) { 

     alert(" data = " + data ) 
    }); 

아약스는 ajax.class.php 내에서 호출하는 기능 :

public function check_whether_first_time(){ 

      $u_id = $this->get('u_id'); 
      $my_user_id=$this->get('my_user_id'); 

      // processing with data goes here 

      $counter=1;   
      echo $counter; 


    }// end of function check_whether_first_time 

내가 data 변수에 $counter의 가치를 얻을 싶어요. 코드는 작동하지 않지만 FireBug는 응답으로 리턴 된 결과가없는 ajax 요청을 표시합니다. 그게 뭐야? ( $ this-> 호출 ('경고 :

+1

사용자 모듈 데이터 변수 나에게 출력을 반환 "어떤 것");'); 코드가 해당 행에 도달했는지 확인하는 것입니다. 사이트에 오류가 있는지 확인하십시오. – Purefan

+0

시험을 보겠습니다. –

답변

0
{literal} 
<script> 
function check(u_id,my_user_id) 
{ 
    $.ajaxCall('user.check_whether_first_time','u_id='+u_id+'&my_user_id='+my_user_id).done(function(data) 
    { 
     alert(" data = " + data) 
    }); 
} 
</script> 
{/literal} 
<a href="javascript:void();" onclick="check('12','123');">click</a> 

으로 시도 난이 기능을 사용하며

아약스 기능

public function check_whether_first_time(){ 

      $u_id = $this->get('u_id'); 
      $my_user_id=$this->get('my_user_id'); 
      $counter=10;   
      echo $counter.$u_id; 
} 
0
$.ajaxCall('organization.getUsersbyid', 'id=' +id+ '&ids=' +ids +'&idss=' +idss +'&idsss=' +idsss); 

public function getUsersbyid() { 

    $id=$this->get('id'); 
    $join=1; 

    $ids=$this->get('ids'); 
    $idss=$this->get('idss'); 
    $idsss=$this->get('idsss'); 
    $add = Phpfox::getService('organization.process')->getUsersbyid($id,$ids,$join,$idss,$idsss); 

}  
+0

정교하게 작성해야합니다. – manuell