javascript - Problems encountered when passing parameter values ​​​​in form forms in ng
巴扎黑
巴扎黑 2017-07-04 13:44:28
0
4
822
In

ng, use the form form to pass parameter values, (ajax, POST request) input and radio selection values ​​​​can be directly obtained, as long as the corresponding field name is bound, now the problem arises. When making multiple selections, it is bound in this way, but the final result is in this form:

index.php?studio_appointment/store&audit={"1":true, "2":false}&content=content&end_time=2017-07-06T23:35:00.000Z&is_foreign=2&is_live=0&live_signal={"2":true,"3":true}...., now the data required in the background The structure is a data structure in the form of
audit=1&live_signal=2,3&is_live=0. Could you please give me some advice?

巴扎黑
巴扎黑

reply all(4)
滿天的星座

Convert your data source before submitting

仅有的幸福

I don’t understand what it means. Is the URL format you want different from the format you get?

Peter_Zhu
<!--html-->
<input type="checkbox" ng-model="value1">
<input type="checkbox" ng-model="value2">
//js
var formData = {}
if($scope.value1){
angular.extend(formData,{"1":$scope.value1})
}
刘奇

var params = lau_vm.launchFrom;

      var checkbox =params.checkbox;
      var res = {};
      angular.forEach(checkbox,function(v,k){
        var value = $.map(v,function(vv,kk){
          return kk;
        });
        res[k] = value.join(',');
      });
      delete params.checkbox;
      $.extend(params,res);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template