叉p
2017-06-29 07:50
采纳率: 50%
浏览 3.6k

jquery ajax怎么按条件查询数据

var app = angular.module('myApp', ['ui.bootstrap']);
app.controller('myCtrl', function ($scope) {
$scope.param = {};
$scope.search = function () {
$scope.loading = true;
$scope.param.orderBy = "id";
$scope.param.pageSize = "12";
$.ajax({
url: apiArtworkReadList,
data: $scope.param
}).then(function (result) {
$scope.loading = false;
if (result.httpCode == 200) {
/*if ($scope.param.saleStatus = 1) {*/
$scope.PageInfo = result.data
/* }*/
} else {
$scope.msg = result.msg;
}
$scope.$apply();

        });
    };

``
jquery 小白,想查询数据中saleStatus=1的数据返回到json类型  应该怎么修改

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • 丵鹰 2017-06-29 07:55
    已采纳
     var app = angular.module('myApp', ['ui.bootstrap']);
    app.controller('myCtrl', function ($scope) {
    $scope.param = {};
    $scope.search = function () {
    $scope.loading = true;
    $scope.param.orderBy = "id";
    $scope.param.pageSize = "12";
    $scope.param.saleStatus = 1;//加上这个添加,后台处理是看到有没有带上这个条件,没有的话还需加上
    $.ajax({
    url: apiArtworkReadList,
    data: $scope.param
    }).then(function (result) {
    $scope.loading = false;
    if (result.httpCode == 200) {
    
    $scope.PageInfo = result.data
    
    } else {
    $scope.msg = result.msg;
    }
    $scope.$apply();
            });
        };
    
    点赞 打赏 评论
  • 南宫文凯 2017-06-29 08:03

    怎么按条件查询数据 :数据不是查询不是按照ajax的问题,最后的的数据一定是从数据库出来的!所以是你数据传导后台,查询

    点赞 打赏 评论

相关推荐 更多相似问题