I'm (trying) to learn javascript, jquery, and knockout all at once here. I finally got a webservice sending back JSON. But I can't display the data. Can someone tell me why this doesn't work? No errors get thrown. There's simply nothing in the form once it's run. The title says it all: it doesnt work, with no explanation as to what's happening. I need to know why not.
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="EditLTC2.aspx.cs" Inherits="RaterWeb.EditLTC2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="formLayout">
<label for="txtInsuredName">Insured Name:</label>
<input data-bind="value: InsuredName" />
</div>
<script>
$(document).ready(function ()
{
var self = this;
// Load selected quote from the JSON service
SelQuote = $.getJSON("http://localhost:46648/LTCJSON.svc/getLTCWithIDs/4/");
// assign to AppViewModel
function AppViewModel()
{
this.InsuredName = ko.observable(SelQuote.InsuredName);
}
ko.applyBindings(new AppViewModel());
});
</script>
</asp:Content>