-1

I am using embeded flash for displaying the camera video inside an asp.net project for passing the camera inf. I am writing variables from flash to the server using Tamper Data extension I know it is sending ok.

The problem is reading it with javascript. How can I? I'm trying to use JSP with the <%...%> but I am not able to read it properly.

This is the code I am using:

document.getElementById("txtID").value = "<%=varActionServer.Value%>";

Where txtID is a textbox and varActionServer.Value is the value of the Server variable that I want.

Chris F Carroll
  • 11,146
  • 3
  • 53
  • 61
Sergio
  • 9
  • 4
  • you mean ASP not JSP? – Chris F Carroll Jan 24 '17 at 02:16
  • <%=varActionServer.Value%> will give you the value at the point the page is loaded. Is that what you intend? – Chris F Carroll Jan 24 '17 at 02:18
  • @ChrisFCarroll It is supposed to be JSP (http://docs.oracle.com/javaee/5/tutorial/doc/bnaou.html); and I intend that when the page is loaded, I should receive the server variables sended by flash, but what I I'm finding is that first the page is loaded, and then the embeded flash is sending the data. It is a synchronization problem. Now I am searching how to insert something like an Event to catch the changing value in the server variables. – Sergio Jan 25 '17 at 19:11
  • your first line says 'asp.net' project though? – Chris F Carroll Jan 25 '17 at 21:57
  • Yes, that is my tool to access the server-side, but, but, but, the inf. sent by flash is after the post back is made, so I cannot see it with my c# code. And @ChrisFCarroll your explanation about the gap between sides helped me a lot with my understatement of the problem, I might have started clarifying those basic concepts from first place. The problem is that all what I'm doing is quasi Autodidactism. – Sergio Jan 26 '17 at 20:55

1 Answers1

0

You need to understand the big gap between client-side and server-side. Serverside variables can only tell you what the server knew when it built the page and before it sent it to the client. JSP is a serverside technology and it, too, can only know what the server knew before it sent the page.

What you are trying to achieve is client-side; that after the page has gone to the client, the page can still be updated. For this, you must forget JSP.

I assume that you are going via the server because you already have a working solution that gets data from the camera, through flash, to the server. In that case you can read data from the server using ajax. The simplest route is jQuery.ajax

Another option might be to throw out the flash solution and use something else. Here' an SO question about that approach: Access camera from a browser

Community
  • 1
  • 1
Chris F Carroll
  • 11,146
  • 3
  • 53
  • 61