LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 01-05-2006, 08:59 AM   #1
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Rep: Reputation: 33
I want to use ajax for my website, can anyone help me?


Since this forum upgrade and use ajax, I had seen how impress ajax perform.
I am wish I can do so with my home page.
I hope there will be some hospitality man here to help me.
At that time I know nothing about ajax and neither do my friend, I know no where to seeking for help.
Google do nothing but make me confuse.
May be you can give me some documents
 
Old 01-05-2006, 10:10 AM   #2
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Mastering Ajax, Part 1: Introduction to Ajax seems like a pretty good place to start.
 
Old 01-06-2006, 11:40 AM   #3
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Original Poster
Rep: Reputation: 33
With the help from that link and some other document, I have got this simple first ajax page, I think it will popup the contains of the file test.txt in the same directory of the page, but it give these value: status: 0
statusText : "" .
Is it true that I must have a web server running to make ajax function or anything else?

Please show me the way.

The code is here:
Code:
<script type="text/javascript">

            var http_request = false;

            function makeRequest(url) {

                http_request = false;

                if (window.XMLHttpRequest) { // Mozilla, Safari,...
                    http_request = new XMLHttpRequest();
                    if (http_request.overrideMimeType) {
                        http_request.overrideMimeType('text/xml');
                    }
                } else if (window.ActiveXObject) { // IE
                    try {
                        http_request = new ActiveXObject("Msxml2.XMLHTTP");
                    } catch (e) {
                        try {
                        http_request = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e) {}
                    }
                }

                if (!http_request) {
                    alert('Giving up :( Cannot create an XMLHTTP instance');
                    return false;
                }
                http_request.onreadystatechange = alertContents;
                http_request.open('GET', url, true);
                http_request.send(null);

            }

            function alertContents() {
			switch (http_request.readyState){
			case 0 : alert( 'uninitlaized'); break;
			case 1 : alert( 'loading'); break;
			case 2 : alert( 'loaded'); break;
			case 3 : alert( 'interractive'); break;
			case 4 :if (http_request.status == 200) {
	                        alert(http_request.responseText);
	                        
	                    } else {
				alert('There was a problem with the request.');
				alert (http_request.status);
				alert (http_request.statusText);
	                    };
		}
	  }
        </script>
The make_request function is called when I click on the an pan tag.

Last edited by TruongAn; 01-06-2006 at 11:43 AM.
 
Old 01-23-2006, 12:38 AM   #4
kundetiprasad
Guest
 
Posts: n/a
your web server needs to be running.

Hi,

I tried few example's for parsing xml using AJAX. Firstly, your webserver should be running when you do xml parsing. Infact, we are checking a http status. I also tried the example below. Put your xml file which needs to be read in the same directory.

A small change from the example was i used a JSP instead of html. I did this since i wanted to extend it further.

Thanks,
Prasad.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for AJAX-based Wiki Software nado Linux - Software 2 12-31-2005 07:21 PM
Website bambeklis General 1 12-13-2005 04:20 AM
"AJAX" and the user experience pnellesen Programming 0 10-25-2005 09:46 AM
website khdo80 Linux - General 3 12-28-2003 11:36 AM
website help im1crazyassmofo Linux - General 8 03-31-2003 01:39 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 03:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration