Software Archive
Read-only legacy content
17061 Discussions

Ionic passing data with JSON

nicolas_r_
Beginner
321 Views

Hi I'm trying to pass data from my APK that is based on HTML using Intel XDK, as framework i use Ionic. I make a form with some text input and comboBox where i get the data that i want to send. I have some part of my code where i get data from a text input and combo box and at the end the JSON. The main problem that i have is how to make fit the data that i get into that JSON structure. 

    <form ng-submit="submitEvent(event)">
                                <label class="item item-input">
                                    <span class="input-label">Rut</span>
                                    <input type="text" ng-model="event.rut">
                                </label>
    <label class="item item-input item-select">
                                <div class="input-label">
                                    Comuna
                                </div>
                                <select ng-model="selectedComuna" ng-options="x for x in comuna track by x"></select>
                            </label>


<script>
            var app = angular.module('myApp', []);
            app.controller('myCtrl', function($scope) {
                $scope.name = '';
                $scope.selectedName = '';
                $scope.region = ["Región de Los Ríos"];
                $scope.names = ["A+", "A-", "B+", "B-", "O+", "O-", "AB+", "AB-"];
                $scope.comuna = ["Corral", "Lanco", "Los Lagos", "Máfil", "Mariquina", "Paillaco", "Panguipulli", "Valdivia", "Futrono", "La Unión", "  Lago Ranco", "Río Bueno" ];
            });
    </script>
    <script>
            angular.module('myApp', ['ionic']).controller('ctrl', function($scope, $http){

              $scope.postData = function () {
                console.log(" posted");
              $http({
                type: 'POST',
                url: 'https://api.parse.com/1/classes/shifts',
                dataType: 'json',  
                data: {
                      input: event.rut 
                },
                headers: {
                    'X-Parse-Application-Id': '',
                    'X-Parse-REST-API-Key': '',
                }
            })
            .success(function (data, status) {

            })
            .error(function (data, status) {

            });
            };
            });
    </script>
0 Kudos
1 Reply
PaulF_IntelCorp
Employee
321 Views

Nicolas -- how to write code in HTML5 and use the various HTML5 frameworks is outside the scope of this forum. I recommend you check the Iconic and Angular forums and StackOverflow for advice on how to do what you are asking.

0 Kudos
Reply