Loading

AJAX Interview Questions Answers

AJAX Interview Questions Answers

Currently, AJAX is used broadly in web technology. It makes the website more use full Few AJAX Interview Questions and Answers are given below.

1. What is AJAX?
Ans:- AJAX is the 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 the advantage of AJAX?
Ans:- There are the following advantage:-
1. AJAX increases the performance and speed of web page
2. We can use Javascript Object Notation (JSON)
3. Reduce the traffic
3. What is the disadvantage of AJAX?
Ans:- There are the following disadvantage of AJAX:-
It depends upon Javascript.
Not secure response
issue with debugging
4. Write a security issue of AJAX?
Ans:- There are the following security issues of AJAX:-
AJAX code user can read.
Hackers can easily hack AJAX code
5. How many types of requests are 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 the complete process synchronous request block the client but asynchronous does not block the client.
7. Write different ready states of AJAX?
Ans:- There are the following states of AJAX:-

0UNSETClient has been created. Open() not yet called.

Value State Description
1 OPENED Open() called. 2 HEADRERS_RECIEVED Send() called and headers are available. 3 LOADING Downloading: responseText holds partial data. 4 DONE The operation is complete.

8. What is XMLHttpRequest in AJAX?
Ans:- XMLHttpRequest is used for exchanging data from the server. It can use JASON, HTML, HTTP protocol
9. What is the syntax of XMLHttpRequest?
Ans:- The syntax of XMLHttpRequest is:-
var xhttp = new XMLHttpRequest();
10. How to cancel current requests in AJAX?
Ans:- Using the abort() method we can cancel the current request.
11. How to return header information in Ajax?
Ans:- getAllResponseHeaders() function return all header information.
getResonseHeader() function returns specific header information.
12. What does open() method do in AJAX?
Ans:- open() method either initialize a 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 opens the connection on the server and send method sends that our request object to the server.
Default send() method uses the GET method but when we want to send a string the 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 the open() method and before calling send() method.
15. write main HTTP status message in AJAX?
Ans:-AJAX return the following status message after the request is sent:-
OK: 200
Forbidden: 403
Not Found: 402
16. How to send the request to the server in AJAX?
Ans:-For send requests we use open() and send() methods.
xhttp.open(“GET”, “ajax-text.php”, true);
xhttp.send();
We can use GET or POST requests to initialize any request in AJAX.
For asynchronous requests, we should use true, and for synchronous requests, we should use false. But in both requests, It is recommendation is to use true for fast execution.
17. What is readyState property in AJAX?
Ans:-readyState property returns the state of the XMLHttpRequest client. It means it holds the status of the XMLHttpRequest.
18. Define onreadystatechange property in AJAX?
Ans:-When the readyState changes, onreadystatechange property calls a function for execution.
19. What is status property and status text property in AJAX?
Ans:-status and status-text property holds the status of the XMLHttpRequest object.
status return numeric values like 200 for OK, 403 for Forbidden, 404 for Page not found, etc.
status text property return string text like OK, Not Found, etc.
20. What is the callback function?
Ans:-Callback function is a function that is passing as a parameter of another function. A callback function is either a named function or an anonymous function.
21. What is the server response property in AJAX?
Ans:-Ajax support two property for XMLHttpRequest object response.
responseText, It returns a string as a response.
response XML, It returns XML data
22. What is the server response method in AJAX?
Ans:-AJAX support the 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 as a pre-requisite to use Update Panel controls.
25. What is the difference between AJAX and JavaScript?
Ans:- AJAX is a technology that asynchronously or synchronously updates part of the UI without reloading the whole webpage. AJAX uses Javascript, XML, CSS, and 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:-
JQuery
Prototype
XAP
DWR
Dojo
Google Web Toolkit
Taconite
Richfaces
MooTools
TigerMouse
ZK AJAX Framework
SPRY
Node.JS
27. What are the technologies used by AJAX?
Ans:- AJAX uses the technologies:-
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 the 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 applies to the 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 files asynchronously to the server.
Yes, it’s possible.
But It requires to use Postback triggers to upload the file.

Read Also:-

Javascript Interview Questions Answers

 

Share with:


Leave a Reply

Connect with:

z35W7z4v9z8w
Verified by ExactMetrics