I have the following html form:
<form name="queryForm" class="form-inline text-center">
<p class="checkbox-inline onlinecheckbox">
<input type="checkbox" class="onlinecheckbox" name="optionsRadios" id="checkOne" value="one" ng-model="formData.one" ng-true-value="'one'" ng-init="formData.one='one'">
One
</p>
<p class="checkbox-inline onlinecheckbox">
<input type="checkbox" class="onlinecheckbox" name="optionsRadios" id="checkTwo" value="two" ng-model="formData.two" ng-true-value="'two'" ng-init="formData.two='two'">
Two
</p>
<p class="checkbox-inline onlinecheckbox">
<input type="checkbox" class="onlinecheckbox" name="optionsRadios" id="checkThree" value="three" ng-model="formData.three" ng-true-value="'three'" ng-init="formData.three='three'">
Three
</p>
<button type="submit" class="btn btn-fill btn-info" style="margin-top:24px;margin-left:8px" ng-click="queryNumbers()">Refresh</button>
</form>
and it shows 3 checkboxes on my page and a button. I want to construct a .post
query to my webservice based on the values user selects. I wrote a function for that:
$scope.queryUsers = function(){
var one = $scope.formData.one;
var two = $scope.formData.two;
var three = $scope.formData.three;
var params = [];
if(one){
}
if(two){
}
if(three){
}
//here I want to create a .post query
};
As for now, I have my webservice ready, it takes the json in the following format:
"one":"true" //can be false
"two":"true" //can be false
"three":"true" //can be false
I want to create a params
array and create post query - how can I fill this array with true
or false
values for each number based on the checkboxs' values?