phpFox中文,获得价值从一个Ajax调用响应 [英] phpfox , get value as response from an ajax call

查看:116
本文介绍了phpFox中文,获得价值从一个Ajax调用响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图让Ajax调用和得到的东西作为回应在 phpFox中文

在JS:

  $ .ajaxCall('module.check_whether_first_time',
 U_ID ='+ U_ID +'和; my_user_id ='+ my_user_id).done(功能(数据){

        警报(数据=+数据)
    });
 

从内部ajax.class.php该Ajax调用的函数:

 公共职能check_whether_first_time(){

            $ U_ID = $这个 - >获得(U_ID);
            $ my_user_id = $这个 - >获得(my_user_id');

            //处理数据放在这里

            $计数器= 1;
            回声$计数;


    功能check_whether_first_time的} //结束
 

我想获得 $计数的值数据变量。在code不工作,但萤火显示没有返回响应结果Ajax请求。什么是路?

解决方案

  $ AjaxCall的('organization.getUsersbyid','ID ='+ ID +'和; IDS ='+ IDS +'和; IDSS ='+智能决策支持系统+'和; idsss ='​​+ idsss);

公共职能getUsersbyid(){

    的$ id = $这个 - >获得('身份证');
    $加入= 1;

    $ IDS = $这个 - >获得(IDS);
    $ IDSS = $这个 - >获得(IDSS');
    $ idsss = $这个 - >获得(idsss');
    $加入= phpFox中文::的getService(organization.process') - > getUsersbyid($ ID,$ IDS,$加入,$ IDSS,$ idsss);

}
 

Trying to make an ajax call and get something as response in phpfox .

the JS :

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

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

The function which the ajax calls from within 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

I want to get the value of $counter in data variable. The code does not work but FireBug shows the ajax request with no result returned as response. What is the way ?

解决方案

$.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);

}    

这篇关于phpFox中文,获得价值从一个Ajax调用响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆