Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

WithoutBook Forum

Ques. Why should I use ajax?

- I am working on an application where should receive database value by giving input on input text box. Should I use Ajax here?

Posted on Jul 14, 2014 by Raj Mohan
Ans. Supposed to be Yes, you should use ajax here, as you are getting database values asynchronously that on this input what are the according values you are getting without refreshing the whole page.

function getXmlHttpReq(){
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");
}
return xmlhttp;
}

function ajaxCall(){
var xmlhttp = getXmlHttpReq();

xmlhttp.open(\"GET\", \"getData\", true );
xmlhttp.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\");
xmlhttp.send(null);
}
Posted on Aug 02, 2014 by adam

Enter your Answer

Name
Email Address
Answer
©2024 WithoutBook