Contents tagged with JavaScript

  • Use XMLHttpRequest to Call ASP.NET Web API

    Most of the times developers use jQuery $.ajax() to call ASP.NET Web API from the client side script. At times, however, you may need to plain JavaScript to invoke the Web API. Luckily, calling a Web API using XMLHttpRequest object and plain JavaScript is not too difficult. This article discusses how that can be done with a sample Customer Web API.

    Read more...

  • Optimize ASP.NET MVC Views with Bundling and Minification Features

    ASP.NET MVC web applications often use client side scripting in one or the other way. Use of JavaScript libraries such as jQuery and frameworks such as AngularJS is quite common these days. Therefore it is important to pay attention to the rendering of the views. Especially, script load time is worth some consideration. Luckily, ASP.NET MVC offers help in the form of bundling and minification features. This article shows how these features can help you optimize the views.

    Read more...

  • Understanding JavaScript Prototypes (and creating your own "$" library)

    Many web applications developed today use some or the other JavaScript library or framework. These libraries and frameworks heavily rely on what is known as JavaScript prototypes. Therefore, it would be interesting to any web developer to understand this concept. This short article explains in brief what JavaScript prototypes are and how they form an integral part of many of the popular JavaScript libraries. You also learn to create your own "$" library.

    Read more...

  • Using LinkedIn JavaScript API for User Authentication and Profile Retrieval

    Integrating third-party sign-in with a website is quite common these days. Just like Facebook and Twitter, LinkedIn too allows you to ingrate LinkedIn authentication with your own website. One simple way to achieve such an integration is to use LinkedIn JavaScript API. Using this API you can authenticate a user with their LinkedIn credentials and also retrieve their profile and connection information. Once retrieved you can use that information to integrate LinkedIn authentication with your website's security and membership framework.

    Read more...

  • Working with Facebook SDK for JavaScript

    Now-a-days many websites provide Facebook integration to enhance the user experience. Features such as Facebook authentication, displaying Like or comments widgets, posting something on a user's wall are parts of this integration. The Facebook SDK for JavaScript provides functionality that can be consumed from the client side script to leverage such an integration. To that end this article shows you how to implement Facebook authentication, how to retrieve a user's details, such as user name and profile picture, and also illustrates how to post on the user's wall.

    Read more...

  • Working with Promises in Windows Store Apps

    To deal with the complexity involved in asynchronous programming, Windows Store apps make use of what is known as a Promise. The implementation of Promises in Windows Store apps is based on Common JS Promises proposal. At code level a promise is an object that represents the result of an asynchronous operation and returns a value at some later time in the future. Promises make it easy to work with asynchronous operations in Windows Store apps. This article discusses what promises are and also shows how to use them in a Windows Store app.

    Read more...

  • Using xhr() in Windows Store Apps

    At times you may need to make cross-domain requests in your Windows store app. This can be done using the WinJS.xhr() function. The xhr() function is an easy to use wrapper over the traditional XMLHttpRequest object. This article introduces you with the xhr() function and many of its configuration options. It also illustrates how the xhr() function can be used to call ASP.NET Web API.

    Read more...