Hey Guys,
In my previous post I have expalined about the difference between Webforms and MVC. In this post I am gonna help you on how to implement AJAX in MVC using jQuery.
Before starting with AJAX in MVC, lets have quick glance at what Ajax is all about.
What is AJAX?
- AJAX is an acronym for 'Asynchronous JavaScript and XML'. It is a technique for creating fast and dynamic web pages.
- AJAX allows to update specific parts of web pages asynchronously by exchanging small amounts of data with the server behind the scenes (request from UI get the modified data back from server). It is possible to update parts of a web page, without reloading the whole page.
- Classic web pages, (which do not use AJAX) must reload the entire page if the content should change.
- Examples of applications using AJAX: Google Maps, Gmail, Youtube, and Facebook tabs.
Earlier, XML is used to exchange the data with Server, ie using XMLHttpRequest object. But these days JSON(JavaScript Object Notation) is used to send and receive the data from UI to server.
What is JSON?
JSON is short for JavaScript Object Notation,
It is a lightweight data-interchange format that is easy for humans
to read and write, and for machines to parse and generate. JSON is based
on the object notation of the JavaScript
language. However, it does not require JavaScript to read or write
because it is a text format that is language independent. Its more like key-value pair.
Here is the example for JSON which is equivalent of XML.
