最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to make AJAX work on local server using XAMPP or node.js - Stack Overflow

programmeradmin0浏览0评论

I am at my wit's end and I'm hoping someone can help.

I have been trying to get AJAX to work on a local server, but I don't know where to begin even with the most basic code. I have downloaded node.js and XAMPP and I have been looking online for tutorials on how to get even AJAX test sites to work.

If anybody knows of a step-by-step tutorial on how to get the most basic AJAX functions to work on node.js or XAMPP I would appreciate it so much. Everything I've found seems to assume the person reading already knows how to begin working with a local server to make the code work. I know what code I need to write from all the examples, I just don't know how to get it to work on XAMPP or node.js! Thank you.

I am at my wit's end and I'm hoping someone can help.

I have been trying to get AJAX to work on a local server, but I don't know where to begin even with the most basic code. I have downloaded node.js and XAMPP and I have been looking online for tutorials on how to get even AJAX test sites to work.

If anybody knows of a step-by-step tutorial on how to get the most basic AJAX functions to work on node.js or XAMPP I would appreciate it so much. Everything I've found seems to assume the person reading already knows how to begin working with a local server to make the code work. I know what code I need to write from all the examples, I just don't know how to get it to work on XAMPP or node.js! Thank you.

Share Improve this question asked Mar 8, 2014 at 19:06 Les PaulLes Paul 1,2785 gold badges22 silver badges47 bronze badges 2
  • Please don't close, because someone else (stackoverflow./questions/21529208/ajax-with-node-js-server) had a similar problem and some people decided the question was too broad. – Les Paul Commented Mar 8, 2014 at 19:13
  • 1 Ajax is just an HTTP request that is send in the background. You set your server up like any other web server, and then, instead of typing the URL in the address bar, you write some JavaScript code to send an XMLHTTPRequest: developer.mozilla/en-US/docs/AJAX/Getting_Started. You don't have to do anything specific with the server. – Felix Kling Commented Mar 8, 2014 at 19:15
Add a ment  | 

3 Answers 3

Reset to default 1

is XAMPP working? can you access it via http://localhost?

AJAX is just javascript that can send requests without reloading the entire page. it doesn't need anything special to work.

however its important that localhost is working and keep note if you need to add a port to the end of the url to get it to work.

then add your html/php file into the htdocs folder of XAMPP and navigate to it using the localhost url.

In case you have Visual Studio installed. Click

  1. File Menu
  2. Open
  3. Web site
  4. Select the website folder
  5. Hit F5 to run the app

First, you have to create your html file; do it in the "htdocs" folder of XAMPP, which is likely to have its folder on your C: hard drive path, unless you moved it elsewhere.

Secondly, start XAMPP Apache server. Now you can access your html web page via web browser at "localhost/yourwebpage.html".

Hope this help everyone!

发布评论

评论列表(0)

  1. 暂无评论