小编sai*_*ram的帖子

我如何得到json响应从PHP格式下?

我有两个表,在yearselection两列中,在那里有testtable2三列,基于在第二个表中使用的第一个表id.,我想使用php,这两个表显示json响应如下.

yearselection:

   id   year
    6   2014-2015
    2   2010-2011
    3   2011-2012
    4   2012-2013
    5   2013-2014
    1   2009-2010
    7   2015-2016
Run Code Online (Sandbox Code Playgroud)

testtable2:

id   name    yearselection
1    test1        2
2    test2        1
3    test3        1 
4    test4        1
5    test5        2
6    test6        3 
Run Code Online (Sandbox Code Playgroud)

我希望以json格式显示如下:

   {
    "2009-2010": [

        {
            "id": "2",
            "name": "test2"
        },

        {
            "id": "3",
            "name": "test3"
        },

        {
            "id": "4",
            "name": "test4"
        }

    ],
    "2010-2011": [

        {
            "id": "1",
            "name": "test1"
        },

        {
            "id": "5",
            "name": "test5" …
Run Code Online (Sandbox Code Playgroud)

php mysql json

5
推荐指数
1
解决办法
78
查看次数

AngularJS:显示加载器图像,直到加载数据

屏幕图像1

屏幕图像2

使用angular js + php显示结果,如何在加载数据之前显示加载器图像,这里我的代码写在下面,

在数据加载完成之前,如何让AngularJS显示加载图像?

app.js文件

var app = angular.module('myApp3', ['ui.bootstrap']);

app.filter('startFrom', function() {

    return function(input, start) {
        if(input) {
            start = +start; //parse to int
            return input.slice(start);
        }
        return [];
    }
});
app.controller('customersCrtl', function ($scope, $http, $timeout) {
    $http.get('http://www.testurl.com/index.php/site/getprofileLocations').success(function(data){

        $scope.list = data;
        $scope.currentPage = 1; //current page
        $scope.entryLimit = 20; //max no of items to display in a page
        $scope.filteredItems = $scope.list.length; //Initially for no filter  
        $scope.totalItems = $scope.list.length;
    });
    $scope.setPage = function(pageNo) {
        $scope.currentPage = pageNo; …
Run Code Online (Sandbox Code Playgroud)

javascript php angularjs

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

php ×2

angularjs ×1

javascript ×1

json ×1

mysql ×1