Skip to main content
Inspiring
October 25, 2019
Question

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

  • October 25, 2019
  • 1 reply
  • 278 views

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

This topic has been closed for replies.

1 reply

GmRAuthor
Inspiring
October 25, 2019

I found the problem!  In my funciton, 

 

this.myDynText.text 	

 

should be

 

_this.myDynText.text 

 

 

Geoff

GmRAuthor
Inspiring
October 25, 2019

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

 

Thanks,
Geoff