(function () {
    var orig = angular.module;
    angular.modules = [];
    angular.module = function () {
        var args = Array.prototype.slice.call(arguments);
        if (arguments.length > 1) {
        return orig.apply(null, args);

//usage:  angular.modules

json and xml to c#




Hello World of AngularJS

This is the simplest test to see if AngularJS is working correctly.

<script src="http://code.angularjs.org/1.0.5/angular.js"></script>

<div ng-app>
    Name: <input type=text ng-model="name">
    Current user's name: {{name}}

and the following is a script test call:

<script language="javascript">
    if (typeof angular == 'undefined') {
        alert('AngularJS not available');

Angular JS simplified




using System.Json for dynamic json

open your package manager console and type:

Install-Package System.Json -Version 4.0.20126.16343

add the reference to your code:

using System.Json;

and finally example usage:

var json = GetJson(input);
dynamic result = JsonValue.Parse(json);

Custom Json

This is how you can write out your own custom Json code in MVC:

public ActionResult hello()
    dynamic d = new JObject();
    d.MetricId = 11;
    string json = Newtonsoft.Json.JsonConvert.SerializeObject(d);
    return Content(json,"JSon");

AllowGet JsonRequestBehavior

Getting the following error:
This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet.

Try to add “JsonRequestBehavior.AllowGet” to your return statement.

public JsonResult GetJsonData()
    MetricValue m = new MetricValue();
    m.Error = "234";
    m.SnapshotId = 4;
    return Json(m, JsonRequestBehavior.AllowGet);

now my output is:



Loading a web page using json data


function UpdateOnClick(param123) {
        type: 'GET',
        url: "/WhereEver/PageToLoad",
        cache: false,
        data: { myKey: myValue },
        dataType: "json",
        async: true,
        success: function (result) {
        error: function (result) {


Quick direct references to Jquery & JqueryU

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>

jQuery.UI available test

    $(document).ready(function() {
        if (jQuery.ui) {
            alert('jQuery.ui is loaded');

        } else {
            alert('WARNING:  jQuery.ui is NOT loaded!!');