Saturday 17 August 2013

Top AJAX interview questions and answers


Questions : What is Ajax ?
Answers : Ajax is nothing but acronym for Asynchronous JavaScript and xml , It is not a new technology even it is not a technology but use to enhance web technology , In 2005 Google developer need to more fast search engine so they suggested to use Ajax . in older days When we need to send / fetch data to / from server page was reload every time hence take more time , use more memory , but being use AJAX no need to reload page again and again for sending small amount of data to server through Ajax we utilize more memory and bandwidth and our website work faster and fastest , also able to move and use fetched data , Ajax is used on client site means with java script and html
 
Questions : What is advantage of Ajax
Answers :  Basic advantage of Ajax is Bandwidth utilization means when we have more type of data on same page or use more included page , hence data is fetched without loading the page it's save memory also it is more interactive no any user want lose their information from that page , so the concentrate only on same page fastest where loading a page is difficult or more time consuming Ajax do best work So why in all modern website need concentration to use Ajax ,it is a Browser technology independent of web server software .

Like every thing advantage and disadvantage Ajax has too some disadvantage like

When we use Ajax it is difficult to return back page , when we click on back button we

Got first page(because same page is using for sending or fetching data but when we need just last use thing we could not able to seen last modified data they gone to starting point

And also need to more concentration because it is faster to implement but still it is very beneficial to us
 
Questions : How AJAX Work ?
Answer : How it work means it use with JavaScript , hence java script can communicate directly with the server by using the JavaScript XMLHttpRequest Object using this object JavaScript fetch and send data without reloading the page .

Following key word used with Ajax though JavaScript ;
1.XMLHttpRequest create object for browser like Firebox ,Muzilla, opera ,safari and other .

2>Internet explore use ActiveXObject
3>onreadystatechange henceActiveXObjectvar. readyState ==4 means response is ready to send and sent by server hence process complete there values like 1,2 ,3 means ,initialize ,in process etc ..
4.>object .status== 200 means status is ok other wise produce error404

5> for open a file or data use

Object. open("GET","file.php",true)
 


Questions : Which two methods are used for handling Cross-Domain Ajax Calls ?
Answer : Cross-domain means the ability to manually or automatically access or transfer data between two or more differing security domain
1) CROS (Cross-Origin Resource Sharing) : Works with all HTTP verbs and Mos modern web browsers. Provides better support for error handling than JSONP.
2) JSONP (JSON with padding) : It is only works HTTP GET verb and on legacy browsers.
 
Questions : What are the disadvantages of AJAX?
Answer : These are the disadvantages:
1) AJAX is dependent on Javascript. If there is some Javascript problem with the browser or in the OS,your AJAX functionality may not work.
2) Search engines generally do not index Javascript present in web pages. AJAX can be problematic in Search engines as it uses Javascript for most of its parts.
3) source code written for AJAX is easily human readable.
4) Debugging is difficult. We have often to use additional Javascript code for that.
5) Data of all requests is URL-encoded. It increases the size of the request. It can cause problem while Paginating through GridView if there is a huge data.
6)Slow and unreliable network connection.
7)Problem with browser back button when using AJAX enabled pages.
 

No comments:

Post a Comment