search

Home  >  Q&A  >  body text

javascript - Problems encountered when passing parameter values ​​​​in form forms in ng

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?

巴扎黑巴扎黑2708 days ago825

reply all(4)I'll reply

  • 滿天的星座

    滿天的星座2017-07-04 13:46:28

    Convert your data source before submitting

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-07-04 13:46:28

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

    reply
    0
  • 天蓬老师

    天蓬老师2017-07-04 13:46:28

    <!--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})
    }

    reply
    0
  • 怪我咯

    怪我咯2017-07-04 13:46:28

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

    reply
    0
  • Cancelreply