CodeCloudy

Azure | .Net | JQuery | Javascript | Umbraco

Javascript/JQuery/json/

on January 17, 2017
  1. Get size of json object
 type="text/javascript">

  var myObject = {'name':'Kasun', 'address':'columbo','age': '29'}

  var count = Object.keys(myObject).length;

  console.log(count);

2. Trying to pass in a boolean C# variable to a javascript variable and set it to true

myjavascript( <%= MyBooleanVariableInCSharp.ToString().ToLower() %> );

You may also want to try:

isFollowing: '@(Model.IsFollowing)' === '@true'

and an ever better way is to use:

isFollowing: @Json.Encode(Model.IsFollowing)

					
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: