Home > AJAX Examples and Tutorials > Start your script with AJAX
Maldives president resigns amid protests
UNP also protest at Hulftsdorp
Indian Coast Guard nabs 5 Lankan fishing boats
SL wins toss
SF brought to court
Get well soon, SLC tells Yuvi
We need democracy plus; Ranil
White flag appeal postponed
UNP DNA join hands in protest
India still ‘world class’ insists Mathews
SL to market Ayurveda drugs
Nine hand grenades found near Aluth Kade Court
Hirunika to join active politics
IPL teams splash the cash for Mahela and Murali
Anoma to lead protest to free SF
US diplomats heading to Sri Lanka
CID probing double murder in Kahawatta
Dr. R.H.S. Samaratunga appointed Sec to Petroleum Ministry
A/L fiasco - Probe team’s mandate limited
Three including police officer injured in Maligawatta shootout
Are you in Love?
10 Top Sex Secrets Men won't Tell
Top 10 — Female Turn Ons
10 Commandments for good wives
How to live a happy and satisfied Life
Did I marry the right person?
Are You Happy
Alcohol makes men BETTER in the bedroom, scientists claim
Too busy for Love Making?
Have you gone off sex?
Love Isn't Blind
Are You A Lazy Lover?
5 Secret Relationship Resolutions
Are You Getting Attracted To Another Person?
Do you feel loved?
Start your script with AJAX
This is a basic ajax script and you can just fetch the code and use it for free, I am not giving much description line by line, but to start ajax you can use, If you have any comments, please click on live help button and leave a message, I will be not online to chat with you, But I will reply to your question if I am free. Thank You.
<script Language="JavaScript">
var http_request = false;
function ShowExistingRecords() {
var email_address= document.getElementById('email_address').value; //(1)
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
http_request.onreadystatechange = ShowExistingRecordsSub;
http_request.open('POST', 'filename.ajax.php?email_address='+email_address, true); //(2)
http_request.send(null);
}
function ShowExistingRecordsSub() {
document.getElementById('showexistingrecordtext').innerHTML = '<small><i>Loading...</i></small>'; //(3)
if (http_request.readyState == 4) {
var response = http_request.responseText;
document.getElementById('showexistingrecordtext').innerHTML = response; //(4)
}
}
</script>
(1) getting the email address from the element id "email_address"
(2) passing parameters to php file
(3) displaying loading on element id "showexistingrecordtext"
(4) displaying the out put from the filename.ajax.php after passing the variable email_address on element id "showexistingrecordtext"
filename.ajax.php can be a normal database program where if your give a slq to the database it will display the result,
What ever the out-put comming from the filename.ajax.php it will display in element id "showexistingrecordtext"
Full Page will be as follows:
<html>
<head>
<script Language="JavaScript">
var http_request = false;
function ShowExistingRecords() {
var email_address= document.getElementById('email_address').value; //(1)
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
http_request.onreadystatechange = ShowExistingRecordsSub;
http_request.open('POST', 'filename.ajax.php?email_address='+email_address, true); //(2)
http_request.send(null);
}
function ShowExistingRecordsSub() {
document.getElementById('showexistingrecordtext').innerHTML = '<small><i>Loading...</i></small>'; //(3)
if (http_request.readyState == 4) {
var response = http_request.responseText;
document.getElementById('showexistingrecordtext').innerHTML = response; //(4)
}
}
</script>
<title>My Profile</title>
</head>
<body>
<p>
<input type="text" name="email_address" size="20" id="email_address">
<input type="submit" value="Get Profile" name="GetProfile">
</p>
<table border="0" width="100%" id="table1" cellpadding="4" style="border-collapse: collapse">
<tr>
<td id="showexistingrecordtext"> </td>
</tr>
</table>
</body>
</html>
Guidelines: You must register with a social media account such as Facebook, Twitter, Yahoo, etc. to comment on this story. Click on the "Login" button below to choose your login account of choice. We welcome your thoughts, but this is not an open forum. For the sake of all readers, please refrain from the use of obscenities, personal attacks or racial slurs. All comments must remain on topic and cyber bullying will not be tolerated. All comments are subject to our terms of service. Comments that do not comply may be removed. Repeat offenders will lose commenting privileges.
News Categories
Accidents and Incidents
Art and Society
Business and Finance
Education and Employment
Environment and Development
Help and Aid
Science and Technology
Security and Politics
Share Market and Exchange Rates
Sports and Entertainment
Tourism and Foreign Affairs
Women and Health
Information
Women and Health
Food Recipes
Love and Relationship
Web and IT
AJAX Examples and Tutorials
Java Scripts Examples and Tutorials
PHP Scripts Examples and Tutorials
Men want good-looking women
Making sex exciting
Duminda unmasked by Anarkali
Too busy for Love Making?
Srikanth Vandana got a Baby Boy-Father and Son Born on Same Day!
Anjali’s days with Bharathiraja and K. Balachandar
Have you gone off sex?
Sex and Shoes
Dirty Talk!
Happy Birthday Surya
Alcohol makes men BETTER in the bedroom, scientists claim
Sexless Marriages
Are You A Lazy Lover?
5 Secret Relationship Resolutions
Outsider Played Actress Sneha Hot Sexy Hip Cheap Photos?

































