My actual task is :
1) Execute a URL
2) This URL returns a string.
3) Parse that string & take required values.
For this, I have created a service & wrote following code :
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST","http://115.112.176.88:9090/fleetvigil/jsp/maps/ForLocator.jsp?cid=girikandptc&vehicle=9665983265", true);
xmlhttp.send();
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
var responseStr = xmlhttp.responseText;
var result = responseStr;
}
};
After executing this service I got error for : var xmlhttp = new XMLHttpRequest();
Error is : ReferenceError: "XMLHttpRequest" is not defined. (UrlExe2#3)
Any help is very much appreciated.
Solved! Go to Solution.
Hi,
You don't have XMLHttpRequest object, this is a browser object and TW Embedded Javascript runs at server side on a RINHO engine.
In order to make HTTP calls, you need to go to Snippets section and select "ContentLoaderFunctions" here you have GetJSON, GetText, GetXML ( equivalent to GET operation ), PostJSON, ( equivalent to POST ),....
Carles.
Hi,
You don't have XMLHttpRequest object, this is a browser object and TW Embedded Javascript runs at server side on a RINHO engine.
In order to make HTTP calls, you need to go to Snippets section and select "ContentLoaderFunctions" here you have GetJSON, GetText, GetXML ( equivalent to GET operation ), PostJSON, ( equivalent to POST ),....
Carles.
Hi Carles,
Thank you for your immediate reply.
I used "GetText" snippest and it works for me.
kind regards,
Rupesh