How to make AJAX work on local server using XAMPP or node.js

狂风中的少年 提交于 2019-12-22 21:16:28

问题


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.


回答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.




回答2:


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



回答3:


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!



来源:https://stackoverflow.com/questions/22273738/how-to-make-ajax-work-on-local-server-using-xampp-or-node-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!