background preloader

Mastering JSON ( JavaScript Object Notation )

Mastering JSON ( JavaScript Object Notation )

Using jQuery and AJAX > DNN Software We’ve come a long way thus far and in our last blog we were able to get our Tasks table data returned as a JSON object via our web service. In this blog we’re going to return to our view control and update it so that we can get these tasks surfaced in our view control. In order to do this we’ll use jQuery, a popular JavaScript library, to help us do some dynamic manipulating of both the layout and data in our view. If you’re not familiar with jQuery I’ve provided some links at the bottom of this blog entry that will be helpful. Sidenote: As I just mentioned we will use jQuery in this tutorial, but you could definitely use other JavaScript libraries such as Angular if you like. Updating the code in our View Now it’s time to get into some code and get these tasks to show in our module already! Open up the View.ascx file in Visual Studio and go into the “Code view”. Beneath the last closing </DIV> tag start a script block. Update your script block to read: Helpful JQuery links:

A re-introduction to JavaScript Why a re-introduction? Because JavaScript is notorious for being the world's most misunderstood programming language. It is often derided as being a toy, but beneath its layer of deceptive simplicity, powerful language features await. JavaScript is now used by an incredible number of high-profile applications, showing that deeper knowledge of this technology is an important skill for any web or mobile developer. It's useful to start with an overview of the language's history. JavaScript was created in 1995 by Brendan Eich while he was an engineer at Netscape. Several months later, Microsoft released JScript with Internet Explorer 3. Because it is more familiar, we will refer to ECMAScript as "JavaScript" from this point on. Unlike most programming languages, the JavaScript language has no concept of input or output. Overview JavaScript is a multi-paradigm, dynamic language with types and operators, standard built-in objects, and methods. And there are some built-in Error types as well.

Introducing JSON Template March 2009 JSON Template is a minimal but powerful templating language, currently implemented in bothPython and JavaScript. To use it, simply copy the Python file or the JavaScript file into your project. Neither has any external dependencies. Since there are over one bajillion template languages for Python alone, it deserves some explanation. But first here are some examples. Simple example This Python example should look familiar to many people.* The JavaScript version is a straightforward translation of this API. Full Example To read this example, keep in mind the following: These few constructs are surprisingly powerful. The following example uses most of the language, but not all. A template string ... ... combined with a data dictionary ... ... gives output: Here is the rendered output: Here is the same example live in JavaScript. Motivation There are a few problems with the state of the art: Nearly all template languages are inexpressive and ill-specified procedural languages. Design License

jQuery check for empty feed How do you get good answers to your questions? Ask good questions. That means: Good Titles: Give your question a concise but informative title. Rather than "Email Forms", use "Sending multiple emails from forms". Do Your Research: Check out the XMod Pro help file, the XMod Pro Guide on this site, do a search in this Answers forum. Hash Tables in Javascript Javascript is a prototype-based object-oriented language. In JavaScript, all non-scalar objects behave as associative arrays, a mapping from property keys to values. The keys and values can be scalars, objects or functions. This tutorial demonstrates how to provide a hash table wrapper around these native objects that avoids stepping on the built-in properties of a JavaScript object and thus makes it more consistent. Introduction A hash table is a permutation of an associative array (i.e. name => value pairs). In JavaScript, all non-scalar objects behave as associative arrays. A short example of an associative array (hash table) in JavaScript is as follows: TIP: Feel free to replace alert() with console.log() if it's supported by your browser (Chrome, Firefox with FireBug, etc). Just as in PHP, the 'foreach' contruct is used to run through the array, doing something for each key => value pair. alert('size of hash table ' + h.length); Hmm. Fundamentals h.one h.one = 1; Summary Attributions

Yahoo Pipes--RSS without Server Side Scripts Filed: Mon, Feb 19 2007 under Programming|| Tags: json pipes rss javascript Something important happened when Yahoo released their new pipes service. Beyond the ability to mash up different internet resources, pipes made it possible for every web-publisher to include RSS feeds on their pages without the need of server side scripts! From conveniently publishing your delicious bookmarks, to making your own launch page, this new service heralds a major, major shift in web publishing. This article delves into how to create and integrate yahoo-pipes RSS into your web page. Introduction Yahoo Pipes is a service which lets you take information on the web, process it, then format it in interesting ways. If you scroll down to the end of the feed page you'll see the traditional RSS label for the feed, the same ol' RSS label which requires a web-server to retrieve and process before it can be sent on to the browser. I've already created, saved, and published a generic feed pipe you can use. IE7 Bug

Man Pages | ManKier understanding javascript arrays - online javascript primer - creating and storing values in javascript arrays An array can be regarded as a set of variables. This does not mean that the variables in an array are related to each other; they are still separate entities in themselves. Arrays helps us group variables, which we plan to use for a particular purpose because accessing their values becomes a lot easier this way. Consider the following table: To store these city names, we can either employ different variables such as city1, city2, city3 ... or insert these values into an array. var city = new Array(); Each array is initialized using the new keyword with the Array() construct (Isn't this similar to using Date()?). city[0] = "New York"; city[1] = "London"; city[2] = "New Delhi"; city[3] = "Sydney"; city[4] = "Tokyo"; city[5] = "Moscow"; city[6] = "Lima"; Each variable in an array begins with the array name followed by a numeric value contained in a pair of square brackets. JavaScript allows us to write the array initialization and assignment statements as one. How are arrays initialized?

JSON for the masses Sunday Feb 19 2006 Your co-workers will love you for writing in JSON because it will most likely not conflict with their scripts that are being called within the same web documents. For Many Years... JavaScript has been portrayed as a very ugly language. Libraries like prototype, script.aculo.us, behavior, and Rico have all made their debut in 2005 and topping the charts of development circles as some of the greatest things to happen for web developers. Why? Because JSON is here. Reasons for JSON JSON is easy. No more fuss of writing function after function that has no meaning to which other group of functions it belongs to What is Object Notation in JavaScript? According to Douglas Corckford's website, JSON is a lightweight data-interchange format. As a simple example, Object Notation can be expressed in the following format: Sample Object Notation Reference Names Names can be anything except one of the JavaScript reserved keywords - which come to find out can actually be quite lengthy. Values

JSDB: JavaScript for databases

Related: