Will AJAX work with XAMPP?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Will AJAX work with XAMPP?

Postby Mitchell » 19. May 2009 04:07

I have a simple web page. All it has on it is a link. When the link is clicked an AJAX call is made to display a one sentence error message. This page is made up of four files. A message.txt file for the error message, index.html, JavaScript file and a file called .DS_Store. The files are located in the same folder inside my htdocs folder of the XAMPP directory. I am fairly certain the code for these files is correct because I down loaded them as-is from an authors web site of the book I am reading. http://bulletproofajax.com/code/ chapter 3 AJAX test. I downloaded two example chapters from this site. Neither of them work on my computer, but both do work at the site I downloaded them from. As far as I can test, XAMPP is installed, configured and running properly. I installed XAMPP 2 years ago. Today I tested it with helloWorld PHP code and it seems to work. I am running Windows XP SP3. Why won't AJAX work? Any help thanks.
Mitchell
 
Posts: 3
Joined: 19. May 2009 03:31

Re: Will AJAX work with XAMPP?

Postby Sharley » 19. May 2009 05:17

When you make a post like yours with much detail in it then it becomes too difficult to read when it is all jumbled up into a single paragraph - try splitting post like yours into smaller comprehensible paragraphs.

Read the xampp\apache\logs\error.log file for any clues why your link is not linking.



I downloaded the 3 files in Chapter 3 and placed them in the xampp\htdocs folder after renaming the index.html file that is already included in the folder to index.html_orig.

I started Apache from the XAMPP Control Panel and entered http://localhost/index.html in my browser.

I was shown the link Click here to see the contents of a text file and after clicking on it I was presented with the resultant text message from the message.txt file:
If you can read this, you have successfully requested a text file from the server.

So there is nothing wrong with Ajax using XAMPP only the way you have implemented it.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Will AJAX work with XAMPP?

Postby Mitchell » 19. May 2009 05:44

Thanks for your response. I will try to structure my paragraphs more clearly next time.

The error log says.

[Mon May 18 15:27:08 2009] [error] [client 127.0.0.1] (20023)The given path was above the root path: Cannot map GET /C:/Program%20Files/xampp/htdocs/ajaxtest/index.html HTTP/1.1 to file

Any idea how I should move these folders around to make this work? I thought I had the directory structured properly.
Mitchell
 
Posts: 3
Joined: 19. May 2009 03:31

Re: Will AJAX work with XAMPP?

Postby Sharley » 19. May 2009 05:56

Your folder structure is fine - xampp\htdocs\ajaxtest
Go through the server:
http://localhost/ajaxtest/index.html
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Will AJAX work with XAMPP?

Postby Mitchell » 19. May 2009 06:01

Thanks for your help. I think I have been going about this the wrong way.

I entered http://localhost/index.html in the address bar and clicked enter. This time clicking on the link caused the error message to appear for the first time.

Before I was opening the web page index.html by clicking its icon in the folder and the link never caused an error message.

Thanks again. I will check out your etiquette link.
Mitchell
 
Posts: 3
Joined: 19. May 2009 03:31


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 52 guests