Home › Forums › XMetaL Tips and Tricks › script example: web service call from XMetaL Author script › Reply To: script example: web service call from XMetaL Author script
Reply to: script example: web service call from XMetaL Author script
November 17, 2009 at 12:19 amOne of my collegues pointed out that I forgot to set the reference to xmlhttp to null at the end of the example code. Please note that any objects that are created using “new” in javascript should be set to null when they are no longer needed. Otherwise XMetaL Author may hang during exit such that the user interface closes but the XMetaL process remains in memory. This causes XMetaL Author to fail to launch until you open the Windows task manager and kill the xmetaL process.
So the code should look like this:
var ASYNCÂ = true;
var xmlhttp = new ActiveXObject(“Microsoft.XMLHTTP”);// this is the XMLHttpRequest object
xmlhttp.open(“GET”,”http://www.w3schools.com/Ajax/time.asp”,!ASYNC);
xmlhttp.send(null);
var time = xmlhttp.responseText;
Application.Alert( time );
//clean up
xmlhttp = null;