AJAX Interview Questions Answers

AJAX Interview Questions Answers

Currently AJAX is used broadly in web technology. It make website more use full Few AJAX interview Questions Answers given below.

1. What is AJAX?
Ans:- AJAX is abbreviation of Asynchronous Javascript and XML.
Ajax uses asynchronous data transfer between the Browser and the web server. It means, it sends and retrieves data without reloading the web page.
2. What is advantage of AJAX?
Ans:- There are following advantage :-
1. AJAX increase performance and speed of web page
2. We can use Javascript Object Notation (JSON)
3. Reduce the traffic
3. What is disadvantage of AJAX?
Ans:- There are following disadvantage of AJAX:-
It is depends upon Javascript.
Not secure response
issue with debugging
4.Write a security issue of AJAX?
Ans:- There are following security issue of AJAX:-
AJAX code user can read.
Hackers can easily hack AJAX code
5. How many types of request in AJAX?
Ans:- An Ajax call is an asynchronous request initiated by the browser that does not directly result in a page transition.
6. Differentiate synchronous and asynchronous requests?
Ans :Until complete process synchronous request block the client but asynchronous does not block the client.
7. Write different ready states of AJAX?
Ans:- There are following states of AJAX :-
0UNSETClient has been created. Open() not yet called.
1OPENEDOpen() called.
2HEADRERS_RECIEVEDSend() called and headers are available.
3LOADINGDownloading: responseText holds partial data.
4DONEThe operation is complete.
8. What is XMLHTTPRequest in AJAX?
Ans:- XMLHTTPReqest is used for exchange data from server. It can use JASON, HTML, HTTP protocol
9. What is syntax of XMLHTTPRequest?
Ans:- The syntax of XMLHTTPRequest is:-
var xhttp = new XMLHTTPRequest();
10. How to cancel current request in AJAX?
Ans:- Using abort() method we can cancel current request.
11. How to return header information in ajax?
Ans:- getAllResponseHeaders() function return all header information.
getResonseHeader() function return specific header information.
12. What does open() method do in AJAX?
Ans:- open() method either initialize newly created request or reinitialize an existing one.
syntax of open() method is open(method, url, async, usr, pwd)
13. What does send() method do in AJAX?
Ans:- open() method open the connection on server and send method send that our request object to the server.
Default send() method use GET method but when we want to send string then send() method uses POST.
14. What is setRequestHeader() method in AJAX?
Ans:- setRequestHeader() method set the value of an HTTP header request. It will call after open() method and before calling send() method.
15. write main HTTP status message in AJAX?
Ans:-AJAX return following status message after request send:-
OK : 200
Forbidden: 403
Not Found: 402
16. How to send request to the server in AJAX?
Ans:-For send request we use open() and send() method.
xhttp.open(“GET”, “ajax-text.php”, true);
We can use GET or POST request for initialize any request in AJAX.
For asynchronous request, we should use true and for the synchronous request, we should use false. But in both request, It is recommendation is to use true for fast execution.
17. What is readyState property in AJAX?
Ans:-readyState property return the state of XMLHttpRequest client. It means it hold the status of the XMLHttpRequest.
18.Define onreadystatechange property in AJAX?
Ans:-When the readyState changes, onreadystatechange property call a function for execute.
19.What is status property and status text property in AJAX?
Ans:-status and statustext property holds the status of the XMLHttpRequest object.
status return numeric value like 200 for OK, 403 for Forbidden, 404 for Page not found, etc.
statustext property return string text like OK, Not Found, etc.
20.What is callback function?
Ans:-Callback function is a a function that is passing as a parameter of another function. A callback function either named function or an anonymous function.
21.What is server response property in AJAX?
Ans:-Ajax support two property for XMLHttpRequest object response.
responseText, It return string as a response.
responseXML, It return XML data
22.What is server response method in AJAX?
Ans:-AJAX support following two method for server response method:-
getResponseHeader() method
getAllResponseHeader() method
23. How we can test the Ajax code?
Ans:- JSUnit is the client side javascript code used as part of JUnit. JSUnit has been used for Ajax code. And also several online testing tools are available.
24. What is a prerequisite for Update Panel in Ajax?
And:- Update panel control is a central part of AJAX functionality in ASP.NET. It is used with Script Manager is pre-requisite to use Update Panel controls.
25. What is the difference between AJAX and JavaScript?
Ans:- AJAX is a technology which asynchronously or synchronously updates part of the UI without reloading the whole webpage. AJAX uses Javascript, XML, CSS, HTML technologies to send an asynchronous request to the server.
JavaScript is a programming language.
26. List Some Common Ajax Frameworks.
Ans:- Some of the common AJAX frameworks are:-
Google Web Toolkit
ZK AJAX Framework
27. What are the technologies used by AJAX?
Ans:- AJAX uses the technologies are:-
HTML/XHTML and CSS – These technologies are used for displaying content and style.
DOM – It is used for dynamic display and interaction with data.
XML – It is used for carrying data to and from server
XMLHttpRequest – It is used for asynchronous communication between client and server.
JavaScript – It is used mainly for client-side validation
28. What are the important methods of XMLHttpRequest?
Ans:- Important methods of XMLHTTPRequest method is:-
abort() – It is used to cancel the current request.
getAllResponseHeaders() – It returns the header details.
getResponseHeader() – It returns the specific header details.
open() – It is used to open the request.
send() – It is used to send the request.
29. What is AsyncPostBackTimeout Property?
Ans:- AsyncPostBackTimeout property apply to ASP .NET framework
It specifies the time, in seconds, before an asynchronous postback timeout occurs if no response is received from the server. The default value is 90 (seconds).
30. Is it possible to use a FileUpload control within the update panel?
Ans:- FileUpload control is an APP.NET control. It allows uploading file asynchronously to server.
Yes, it’s possible.
But It requires to use Postback triggers to upload the file.

Share with:


Leave a Reply

Connect with: