I’ve been doing a lot of AngularJs lately.
One fact about angularjs is that, initially you like the magic that comes down with angular, but soon get lost in loose conventions and the freedom it gives.
Well, I’m logging some writes I found interesting, regarding the issue and how to go about it.
I’ve read some till the bottom line, and some not.
Bookmarking them here, to catch later.
So if you are tired of trying to get w3school’s HelloWorld Ajax example to run in your Pc locally – Stop!
Its not gonna work unless you have a local server up and running.
Thanks to Azhar.
Thats because, remember ajax depends on a xmlHttp Object for sending and recieving data, This should obviously mean that the file you try to access like ajax_info.txt from w3school’s example should be accessible over http.
So, first install a local server capable of accessing files in your disk and that should make your example work. Enough of scribbles. Lets move to our step by step thing
- Install a server. In our exam its going to be tomcat6. Get it running on your system.
- Dont forget to checkbox the examples option while installing, it would be of use if you happen to be a geek.
- Launch the browser, point to 127.0.0.1:8080 and look for the tomcat page. If nothing turns up, error! check your installation.
- If everything is fine, Just move you ajax programs to the webapps directory of your tomcat installation
- You may probably find that directory in something like C:/program files/Apache software …/tomcat6/webapps
- Now run the program by calling 127.0.0.8080/your_program.html
Abracadabrah! It works!
And if you ever want to experiment something, more than our useless lab exam, do try setting up xampp or wamp.It’s more straight forward and easy.Thanks, Gopaal.