Greetings to all experts here. I am venturing into the world of AngularJS' $http.post for the first time and have encountered a situation where I need to save the data I am passing in a variable beforehand. Here is what I have created:
var data = {
"users": [
{
"requestId": val,
"fields": [
{
"name": "First Name",
"value": $scope.FirstName
},
{
"name": "Middle Name",
"value": $scope.MiddleInitial
},
{
"name": "Last Name",
"value": $scope.LastName
},
{
"name": "Role",
"value": "Contractor"
},
{
"name": "usr_manager_key",
"value": "10001"
},
{
"name": "MANAGEDSERVICE",
"value": "Yes"
},
{
"name": "Job Title",
"value": $scope.JobTitle
},
{
"name": "Start Date",
"value": $scope.SelectedStartTotal
},
{
"name": "End Date",
"value": $scope.SelectedEndTotal
},
{
"name": "DOB_DAY_HASH",
"value": $scope.SelectedDOBDay
},
{
"name": "NATIONAL_ID_HASH",
"value": $scope.SSN
},
{
"name": "act_key",
"value": 1
}
]
}]
};
It's important to note that these values are from ng-models in the form views, and the entire section is enclosed within its own Controller. The provided code snippet belongs to that controller.
However, my problem arises as it throws an error in my code and does not return as valid JSON. Can someone provide assistance? Could it be that this is not valid JSON and I am just making a beginner mistake? I apologize if this issue seems trivial.