Jump to content

ajax for webserver


Recommended Posts


am able to run using XAMPP on PC.

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


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);

Please suggest


Thanks and Regards

Rizwan Syed

Link to comment
Share on other sites

(1) Check if board picks up submitted form data

Create a form, submit with text type inputs first name/last name (give them each a default value of 'John' & 'Doe') to board using get or post see if the board is able pick up the submitted data of 'John' and 'Doe'.

If your board can't do this simple basic operation you need to consult with the boards forum to find out HOW TO DO THIS.

AJAX does the same thing BUT! without leaving the page, the form needs method: 'post' or 'get', action: where to send/what file to access, the AJAX parameters need the same. So unless you achieve the same result as using the form, its pointless discussing this further. This is more likely a board 'how to' problem, than anything to do with html, JavaScript or server script.

It like asking a car mechanic how to fix a jet engine, 'I keep pressing the accelerator pedal, but the jet engine doesn't do anything, its like there's no reaction to the accelerator being pressed'

Link to comment
Share on other sites

Hi Dsonesuk,

Actually form usage i have checked with html.it works fine.

With Ajax am trying to use setInterval("loadDoc()", 1000); as shown in attached figure.

Every 1 sec, i can able to see the data receiving at POST request on board side ( checked through breakpoint).


Now in sd card i have kept a file "ajax_info.txt" with some static data in it.But am not getting any data.



Link to comment
Share on other sites


Now it is able to read the data from my file ajax_info.txt.Only static data present in file am getting.

So now how can i get updated value from my board.

DO i need to write  it continuously   to ajax_info.txt  or any other way to do it.

Edited by rizwansyed
Link to comment
Share on other sites

At the moment it sounds as though you are continuously reading info from text file, which the board can pick up on? You are not sending data values to the board which the board can pick up, as explain under heading 'POST Requests' in


You can then loop the index name ("fname" and "lname") along with a values ("Henry" and "Ford") using a variables to change these values instead of manually entered as used in

xhttp.open("POST", "ajax_test.asp", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

Where the url can be like your very previous original post script "/language" if that will work?

I don't remember if the boards forum AJAX example used this way or not?

Link to comment
Share on other sites

Hi Dsonesuk,

The above mentioned method is not working.I only get whatever data is available in file.Not henry ford.

I forgot to tell i used GET method to get data continuously.

Now am getting the dynamic data, thats fine.

I have a input text box in my HTML page. What ever the dynamic data i receive is it possible to keep it in text box.


Please suggest


Link to comment
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
  • Create New...