خرید بک لینک

Vote count: 0

i am trying to store form data into database through angularjs but it is not storing into database, don't know what i am doing wrong?

my html form

<form  id="challenge_form" class="row" >
            <input type="text" placeholder="Challenge Name" ng-model="challengeName" />
            <select class="btn-group form-control" id="sel1" ng-model="challengeType">
                <option>-- Select Activity Type --</option>
                <option value="ruing">Ruing</option>
                <option value="walking">Walking</option>
                <option value="cycling">Cycling</option>
            </select>
            <input type="date" placeholder="Start Date" ng-model="startDate" />
            <input type="date" placeholder="End Date" ng-model="endDate" />
            <input type="button" class="btn btn-theme" ng-click="newChallenge()" value="Decide Prize">
            <input type="button" class="btn btn-theme"  value="Cancel">

        </form>

my angularjs controller

app.controller("NewChallengesController", ["$http", "$scope", "authenticationSvc", function ($http, $scope, authenticationSvc) {
    //alert("hello, inside New Challenge Controller");

    var token = authenticationSvc.getUserInfo();
    var config = {
        headers: {
            'h5cAuthToken': token.accessToken,
            'Accept': 'application/json;odata=verbose'
        }

    };


    $scope.newChallenge = function () {
        var data = {
            "challengeName": $scope.challengeName,
            "selectedRewardId": "283081",
            "startDate": $scope.startDate,
            "endDate": $scope.endDate,
            "activityCategoryId": 51,
            "minParticipant": 0,
            "referredNumbers": "9876543213",
            "distance": 15.0,
            "challengeType": $scope.challengeType
        };

        $http.post("http://103.19.89.152:8080/ccp-services/userchallenge/create", data, config).then(function (response) {
            alert("challenge created successfully");
        });
    };

}]);

i am getting the alert "challenge created successfully" but data is not storing into database, any help highly appreciated!!

asked 55 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 18 تير 1395 ساعت: 17:33

صفحه بندی