Highlighted

How to return non-XML text from an ASP script?

Community Beginner ,
Oct 24, 2019

Copy link to clipboard

Copied

My HTML5 Canvas needs to check for user authentication, so it queries an asp script for a session status result (just a simple string).  But I am not able to get it to work.  I have created a simple testing asp script:

 

 

<%
response.write "GOT_HERE" 
%>

 

 

I can confirm this script returns 'GOT_HERE' to the screen when loaded directly in the browser.

 

I attempt to query it in my canvas via:

 

 

$('#dom_overlay_container').on('click', '#button1', function() {
			
			this.myDynText.text = "Step 1";
				
			  var xhttp = new XMLHttpRequest();
		
			  xhttp.onreadystatechange = function() {
				  this.myDynText.text = "Step 2";				  
				  if (this.readyState == 4 ) {
					this.myDynText.text = this.responseText;					
				}
			  };
			  xhttp.open("GET", "TEST.asp", true);
			  xhttp.send();
			
		}.bind(_this));

 

 

I successfully get to Step 1, but not Step 2.  Any idea what's wrong?

 

Thanks,
Geoff

TOPICS
Code

Views

54

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to return non-XML text from an ASP script?

Community Beginner ,
Oct 24, 2019

Copy link to clipboard

Copied

My HTML5 Canvas needs to check for user authentication, so it queries an asp script for a session status result (just a simple string).  But I am not able to get it to work.  I have created a simple testing asp script:

 

 

<%
response.write "GOT_HERE" 
%>

 

 

I can confirm this script returns 'GOT_HERE' to the screen when loaded directly in the browser.

 

I attempt to query it in my canvas via:

 

 

$('#dom_overlay_container').on('click', '#button1', function() {
			
			this.myDynText.text = "Step 1";
				
			  var xhttp = new XMLHttpRequest();
		
			  xhttp.onreadystatechange = function() {
				  this.myDynText.text = "Step 2";				  
				  if (this.readyState == 4 ) {
					this.myDynText.text = this.responseText;					
				}
			  };
			  xhttp.open("GET", "TEST.asp", true);
			  xhttp.send();
			
		}.bind(_this));

 

 

I successfully get to Step 1, but not Step 2.  Any idea what's wrong?

 

Thanks,
Geoff

TOPICS
Code

Views

55

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 24, 2019 0
Community Beginner ,
Oct 24, 2019

Copy link to clipboard

Copied

I found the problem!  In my funciton, 

 

this.myDynText.text 	

 

should be

 

_this.myDynText.text 

 

 

Geoff

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 24, 2019 0
GmR LATEST
Community Beginner ,
Oct 24, 2019

Copy link to clipboard

Copied

Would anyone have a moment to explain why?  I don't understand the scope of this, _this, that, etc.

 

Thanks,
Geoff

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 24, 2019 0