Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:52:39+00:00 2026-06-17T06:52:39+00:00

guys. I’m trying to call some AJAX Post trhu AngularJS, and I want to

  • 0

guys.
I’m trying to call some AJAX Post trhu AngularJS, and I want to send all properties from my $scope variable. I have this form:

<div ng-controller="DiscountPrintsCtrl">

    <div>
    Choose the year:
    <select ng-model="selectedYear" ng-change="searchCourses()">
        <option ng-repeat="year in years" value="{{year.ID}}">{{year.Name}}</option>
    </select>
</div>

<div>
    Choose the course:
    <select ng-model="selectedCourse" ng-change="searchStudents()">
        <option ng-repeat="course in courses" value="{{course.ID}}">{{course.Nome}}</option>
    </select>
</div>

<div>
    Choose the student:
    <select ng-model="selectedStudent" ng-change="searchStudentDetails()">
        <option ng-repeat="student in students" value="{{student.ID}}">{{student.Name}}</option>
    </select>
</div>

<div ng-model="studentDetails">
    Details about the student:<br /><br />
    <label>Name: {{studentDetails.Name}}</label><br />
    <label>Number: {{studentDetails.Number}}</label><br />
    <label>Print quote: {{studentDetails.PrintQuote}}</label><br />
</div>

<div>
    <table>
        <thead><tr>
            <td></td>
            <td>Title</td>
            <td>Grade</td>
            <td>Summary</td>
            <td>Author</td>
            <td>Number of pages</td>
        </tr></thead>
        <tbody>
            <tr ng-repeat="publication in publications">
                <td><input type="checkbox" ng-model="publication.Selected" /></td>
                <td>{{publication.Title}}</td>
                <td>{{publication.Grade}}</td>
                <td>{{publication.Comments}}</td>
                <td>{{publication.Author}}</td>
                <td>{{publication.NumberOfPages}}</td>
            </tr>
        </tbody>
    </table>
</div>

<button ng-click="submitForm()" value="Confirm discounts" />

And I have this JS:

<script type="text/javascript">

function DiscountPrintsCtrl($scope, $http) {


    $http.get(url).success(function (years) {

        $scope.years = years;
        $scope.selectedYear = '';

    });

    $scope.searchCourses = function() {

        var url = '/json/GetCoursesFromYear?' + 
            'selectedYear=' + $scope.selectedYear;
        $http.get(url).success(function (courses) {
            $scope.course = courses;
            $scope.selectedCourse= '';
        });
    }

    $scope.searchAlunosAnoSemestre = function() {

        var url = '/json/GetStudentsFromCouse?' +
            'selectedCourse=' + $scope.selectedCourse;

        $http.get(url).success(function(students) {
            $scope.students = students;
            $scope.selectedStudent = '';
        });
    }

    $scope.searchStudentDetails = function() {

        var url = '';

        url = '/json/GetStudentDetails?' +
            'selectedStudent=' + $scope.selectedStudent;

        $http.get(url).success(function(studentDetails) {
            $scope.studentDetails= studentDetails;
        });

        url = '/json/GetPublicationsForStudent?' +
            'selectedStudent=' + $scope.selectedStudent;
        $http.get(url).success(function(publications) {
            $scope.publications = publications;
        });
    }

    $scope.submitForm = function () {
        // How to submit the entire $scope???
    }
}

Any idea? Any considerations about my JS code??
Thanks all!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:52:40+00:00Added an answer on June 17, 2026 at 6:52 am

    You have typos to fix, friend:

    In the .js:
    $scope.course = courses;
    Should be $scope.courses!

    In the html:
    {{course.Nome}}
    Shouldn’t it be:
    {{course.Name}}
    ?

    I see some Spanish (?) above there but everywhere else you say .Name so it’s best to be consistent, right?

    That said, it seems fine to load an object into your $scope from the external json data store as you seem do be doing in each function, loading from the json URLs. The commenters on your post didn’t seem to recognize this? I think they believe you’re trying to permanently store this data in $scope? Maybe I’m not seeing something that they are… but if you don’t add your data model object sometime into $scope.something then {{something}} simply won’t work, and neither will {{something.else}}.

    Am I way off base here?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Guys, for some reason EL is not telling actions from properties. I have this
guys I want to start programing with C++. I have written some programs in
Guys, I'm trying to convert something from C# to VB.NET and I'm having trouble
Guys. I use getpixel & getdata to retrieve data from the same pic.but some
guys. I'm working on some audio services on iOS. I trying to search any
Guys i want to get the top 3 disease and also their count from
Guys I am trying to pass some data to my typeahead form, but for
guys am having some troubles with running out of memory when displaying an animation
Guys, what is function called after my class loaded, where i can call self
guys please post me an example for threading in MFC....it should show the progress

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.