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 8775245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:45:25+00:00 2026-06-13T18:45:25+00:00

I know for a fact that you can create 2 way bindings in knockout.js.

  • 0

I know for a fact that you can create 2 way bindings in knockout.js. This changes the model in javascript once you change the view and the opposite. I need a way to notify and send this changes back to the server. So I pretty much need to do a post to the server. How can I do this?

What I mean by this, is that I somehow need to attach an event handler so whenever I change once of my models it automatically posts back to the server the changes.

  • 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-13T18:45:26+00:00Added an answer on June 13, 2026 at 6:45 pm
    function MyViewModel() {
        var self = this;
        self.value1 = ko.observable();
        self.value2 = ko.observable();
        ko.computed(function() {
            $.ajax({
                url: '/path/to/server/endpoint',
                type: 'POST',
                data: {
                    value1: self.value1(),
                    value2: self.value2()
                }
            });
        });
    }
    

    You should not need individual “manual subscriptions” for each viewmodel property. Just define a ko.computed. All ko.computeds are automatically notified of changes to the observables that they depend on. In the code above, the computed depends on the value1 and value2 observables (in the data argument to the jQuery $.ajax function). Whenever the value of an observable changes, the wrapped ko.computed function will execute, and submit the new value(s) to the server.

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

Sidebar

Related Questions

I know for a matter of fact that Type cannot be used when passing
Ok I know this is simple, in fact damn simple, I did this in
I know that this sort of question has been asked here before, but still
I have a model, Game , which has_many :piles . In fact, I know
Know this might be rather basic, but I been trying to figure out how
Know if it's possible to access the iPhone compass in Safari using JavaScript? I
I know you can not set a key value dynamically, but what about the
I know that Phonegap has an event for back button, but it's only available
Anyone know how I can make a login button in Ruby on Rails for
i know this is a stupid question but i d'ont know how to do

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.