views:

28

answers:

2

I want to change a value of a field say document.getElementById('reloader').innerHTML = updated value from Server I do not want to use Ajax, PHP, ASP, JSP .. or anything like these.

Is it possible by using simple javascript?

Server is C# 's application made by using HttpListener.

Please question if needed more info.

+1  A: 

You can't do it without using something like AJAX, unless you're willing to update the entire page. Somehow, the browser has to contact the server, trigger an action there, and receive and process the response.

Thus, you can use XMLHttpRequest, or you could use JSONP or something similar. In any case something has to be written on the server to respond to the request and supply the data, and that's not going to be "simple Javascript" unless you've got a server-side Javascript solution (which is not impossible of course, but probably unlikely).

Pointy
Hey, :) For now I am assuming that anything can be written on the server side to respond to the request.
Rahul2047
A: 

I am not sure why you dont want to use Ajax. But i believe the only other workaround then can be use an iframe on your page point to the server script and write javascript to read it. I havent tried it recently but i believe it should work

sushil bharwani
Yes I was also thinking that.I have tried it but some how HttpListener responding more than once if I use iFrame. I wanted to auto refresh it to get the whole iFrame updated. But on loading (without having auto refresh implemented), inside the iFrame, first time it loads the html file I wanted to, but the second time it loads the default file which I kept for the home page load ( inside the iFrame). I could not find the solution for it .. so I though of putting Javascript related question here. I also need some other similar examples to compare, whether those are behaving similarly.
Rahul2047