Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

XMLHttpRequest equivalent in Illustrator CS6 JavaScript?

$
0
0

Is there any way to make an XMLHttpRequest equivalent in Illustrator CS6 JavaScript?

 

I'd love to be able to have an Illustrator script make use of returned JSON. Is it possible? For instance, in plain old HTML and vanilla JavaScript, Id' do this:

 

<!DOCTYPE html><html lang="en-US">    <head>        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />        <title>AJAX</title>        <script type="text/javascript">            var xmlHttp = null;            xmlHttp     = new XMLHttpRequest();            xmlHttp.open( "GET", "http://example.com", false );            xmlHttp.send( null );            var data    = JSON.parse(xmlHttp.responseText);            alert(data.string);        </script>    </head>    <body style="background-color:#e5eecc;">        <div>Trying to grab some tasty JSON data.</div>    </body></html>

 

However, when I try a similar thing in a Illustrator script, I get "Error 22: XMLHttpRequest does not have a constructor."

 

I have full control over the server the JSON would be coming from if that helps.


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>