Jump to content
rizwansyed

AJAX post method

Recommended Posts

Hi

I am working on AJAX basics of post.

https://www.w3schools.com/js/tryit.asp?filename=tryjs_ajax_post

I have tried above example and it prints as below:

 

This content was requested using the POST method.

Requested at: 8/29/2018 7:46:26 AM

 

How Does This gets printed? Is it getting the data from "demo_post.asp".

Can anyone share the contents of "demo_post.asp" and clear understanding how it works

 

Thanks and Regards

Rizwan Syed

Share this post


Link to post
Share on other sites

Hi

I have loaded the same file on my PC 

xhttp.open("POST", "index_1.txt", true);

and i have index_1.txt file in my same folder as html file.

When i press the button , am not getting the content present in index_1.txt file

 

Please suggest

Share this post


Link to post
Share on other sites

Most browsers do not allow AJAX to work on the local filesystem by default due to security settings, it has to be from a server. You can install a test server on your computer using XAMPP or WAMP and test AJAX on the localhost domain.

Share this post


Link to post
Share on other sites

Hi

1.Now am able to run using XAMPP on PC.

 

2.Instead of using second argument with file name, is it possible to use as a function and call it in same file in below code

xhttp.open("POST", "index_1.txt", true);

 

3.When i run from my board, am not getting proper data.

I mean it is not fetching the file index_1.txt.html and index_1.txt file are available in same path in sd card.

Anything wrong

Please suggest

 

Thanks and Regards

Rizwan Syed

Edited by rizwansyed

Share this post


Link to post
Share on other sites

 

Hi 

How to run ajax code in my web browser.

Do i need to install a test server on board side to support it?

Edited by rizwansyed

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×