1. Introduction This article is the last one of a series of three on real-time applications. In the part 1, I have created a simple Task management application and implemented the Periodic Refresh AJAX pattern to make it feel as if the UI was updated in real-time when tasks were created. In the part 2,
Tag Archives: AJAX
In this article we will learn about how to use NumericUpDown control of Ajax in ASP.NET using C#.
Using $http and $q
One way to make AJAX calls using AngularJS is using the services $http and $q:
- The $http service allows us to make the GET and POST calls.
- The $q service is used to wait asynchronously for the response, basically it is a deferred result, it returns a “promise” that will response after some time. After some time the deferred can be “resolved” or “rejected”. The method using this deferred can add two call-backs to it one to execute when it is resolved and one when it is rejected.
Let say we have a controller that needs to populate some data asynchronously. I like to dedicate the controller to define the binds for our views. The AJAX call will be executed in a different file, a repository.
AngularJS – Controller: The module will call a repository and add set the response in the scope when the deferred is resolved.
AngularJS – Repository: The repository make an AJAX Get request to a ASP.NET WebAPI Controller.
We can write the same repository with less lines using shortcut methods:
This solution works but there is an easier way to do AJAX calls…
This service lets us interact with RESTful server-side data sources with a higher-level than the $http service. The $resource service is defined in the module ‘ngResource’ and this module is in the file angular-resource.js.
The first thing that we need to do is to reference the angular-resource.js file and add this module as a dependency of our module:
Using the $resource we can write our controller and repository easier because we don’t have to deal directly with deferred objects.
This is now the implementation of our controller and repository using the Angular service $resource , really easy!
About these ads
At the time of writing Bootstrap 3.3.5 is the most current version, and it’s worth mentioning that we are using a default build of Bootstrap (with a 12 column layout) for this tutorial. When following along make sure you use the latest snippets and code structures as outlined by the Bootstrap documentation.
Ajax is a client-side script that communicates to and from a server/database without the need for a postback or a complete page refresh.
The best definition for Ajax would be “the method of exchanging data with a server, and updating parts of a web page – without reloading the entire page.”
In this example we will learn about GWT JSNI. The Google Web Toolkit is a development framework for creating Ajax-enabled web applications in Java. Tools and technologies used in this example are Java 1.8, Eclipse Luna 4.4.2, Eclipse GWT Plugin 2.6
When we develop JSF application with AJAX behaviour, we may experience the problem in handling timeout scenario of Ajax request. For example, if you are using J2EE Form-based authentication, a normal request should be redirected to the login page after session timeout. However, if your request is AJAX, the response could not be treated properly on the client-side. User will remain on the same page and does not aware that the session is expired.
Many people proposed solution for this issue. The followings are two of possible solutions involve the use of Spring security framework:
1. Oleg Varaksin’s post
2. Spring Security 3 and ICEfaces 3 Tutorial