Message from discussion
ko.toJSON Issues
Received: by 10.43.13.137 with SMTP id pm9mr11319977icb.0.1346835420012;
Wed, 05 Sep 2012 01:57:00 -0700 (PDT)
X-BeenThere: knockoutjs@googlegroups.com
Received: by 10.50.178.73 with SMTP id cw9ls1845760igc.4.canary; Wed, 05 Sep
2012 01:56:58 -0700 (PDT)
Received: by 10.43.9.8 with SMTP id ou8mr11258192icb.4.1346835418632;
Wed, 05 Sep 2012 01:56:58 -0700 (PDT)
Received: by 10.43.9.8 with SMTP id ou8mr11258191icb.4.1346835418585;
Wed, 05 Sep 2012 01:56:58 -0700 (PDT)
Return-Path: <hasteb...@gmail.com>
Received: from mail-iy0-f176.google.com (mail-iy0-f176.google.com [209.85.210.176])
by gmr-mx.google.com with ESMTPS id ba5si5337989igb.3.2012.09.05.01.56.58
(version=TLSv1/SSLv3 cipher=OTHER);
Wed, 05 Sep 2012 01:56:58 -0700 (PDT)
Received-SPF: pass (google.com: domain of hasteb...@gmail.com designates 209.85.210.176 as permitted sender) client-ip=209.85.210.176;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of hasteb...@gmail.com designates 209.85.210.176 as permitted sender) smtp.mail=hasteb...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-iy0-f176.google.com with SMTP id t4so597957iag.21
for <knockoutjs@googlegroups.com>; Wed, 05 Sep 2012 01:56:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to
:content-type;
bh=jfVNr8P5WZ08uSWeqSO5fI/xALvEZcz24Bl7CsApZKE=;
b=QgqCg2g6RHxvN7thsKfJMSJoqEgBUSRLhg/BrsqfjttVVNRbBTxXZgnLZ+Kbc3xtex
4QvByDRGvC9DPhWPC3ZdSFvwIUF8nGpnWvqh7igjM+fbyjvNd9uZvKfp7jL/qeZgyBZ6
p5v9zvKSTCXNo7DvosqYCJ8zOR9sQOC5bafvx4qC+6+N4JiI6N5EyM8DYcbPHkQUCxRr
jvdE1aoB2HQMmXd/n6yLk5IVZEWWbyAouYjF6YAUq7Ov6JCtoh2xKfIBI6dC4NF8qsAC
ahtrlCxzgFA9UPfWXFl8Xtqwbiw0E/AHvK2c6TF8Ef6XZqyDTDp+Egq1OVhiysBOurxp
vboQ==
Received: by 10.182.139.99 with SMTP id qx3mr16564880obb.102.1346835418331;
Wed, 05 Sep 2012 01:56:58 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.182.85.104 with HTTP; Wed, 5 Sep 2012 01:56:37 -0700 (PDT)
In-Reply-To: <086e3656-95e8-423d-aef7-880718937890@googlegroups.com>
References: <086e3656-95e8-423d-aef7-880718937890@googlegroups.com>
From: Benjamin Gudehus <hasteb...@gmail.com>
Date: Wed, 5 Sep 2012 10:56:37 +0200
Message-ID: <CANdUZf-DpLqaTimY2ww4jozu3enTUSOqhLKx95c4Nt6LaUm...@mail.gmail.com>
Subject: Re: ko.toJSON Issues
To: knockoutjs@googlegroups.com
Content-Type: multipart/alternative; boundary=e89a8f839adbae383504c8f08e62
--e89a8f839adbae383504c8f08e62
Content-Type: text/plain; charset=ISO-8859-1
Maybe your viewModel is a function?
> console.log(typeof(viewModel))
function
2012/9/5 <mr.brad.lawre...@gmail.com>
> I am attempting to use ko.toJSON to prep my data before I send it to the
> server and I am unable to get the data.
>
> in HTML <pre data-bind="text: ko.toJSON($data, null, 2)"></pre> works
> great!
>
> BUT in javascript ko.toJSON(viewModel) is returning undefined! WHY?
>
> Also if I use ko.toJS(viewModel) it works but I get all the function code.
>
> Anyone have any ideas?
>
--e89a8f839adbae383504c8f08e62
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Maybe your viewModel is a function?<div><br></div><div><div>> console.lo=
g(typeof(viewModel))</div><div>function</div><br><div class=3D"gmail_quote"=
>2012/9/5 <span dir=3D"ltr"><<a href=3D"mailto:mr.brad.lawre...@gmail.c=
om" target=3D"_blank">mr.brad.lawre...@gmail.com</a>></span><br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">I am attempting to use ko.toJSON to prep my =
data before I send it to the server and I am unable to get the data.<br><br=
>
in HTML <pre data-bind=3D"text: ko.toJSON($data, null, 2)">=
</pre>=A0 works great!=A0 <br><br>BUT in javascript ko.toJSON(viewMod=
el) is returning undefined!=A0 WHY?<br><br>Also if I use ko.toJS(viewModel=
) it works but I get all the function code.<br>
<br>Anyone have any ideas?<br></blockquote></div><br></div>
--e89a8f839adbae383504c8f08e62--