Import.io simple script javascript

I am trying to use the integrated simple import.io with JavaScript (sample site) but the script is not working. Can you help me?

  <!DOCTYPE html>   <html> <head>   <title>Import&bull;io
 Example</title>   <script
 src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
 <!-- 1. Include the client library -->   <script
 src="https://cdn.import.io/js/2.0.0/importio.js"></script>

 <!-- 2. Configure the library -->   <script type="text/javascript">
     importio.init({
       "auth": {
        "userGuid": "XXX",
         "apiKey": "XXX"
       },
       "host": "import.io"
     });

     // Data and done callbacks
     var dataCallback = function(data) {
       console.log("Data received", data);
       for (var i = 0; i < data.length; i++) {
        var d = data[i];        for (var k in d.data) {
          document.write("<i>" + k + "</i>: " + d.data[k] + "<br />");      }       document.write("<hr>");       }
     }
     var doneCallback = function(data) {
       console.log("Done, all data:", data);
       document.write("<b>Done</b><hr>");
     }

 // 3. Do the query (when the function is called)
     var doQuery = function() {
       // Query for tile Magic Api
       importio.query({
         "connectorGuids": [
           "a362c175-e265-4f96-867c-5610686bbb21"
         ],
         "input": {
           "webpage/url": "http://www.davy.ie/markets-and-share-prices/iseq"
         }
       }, { "data": dataCallback, "done": doneCallback });
     }   </script>   <body>
     <button onclick="doQuery()">Query</button>   </body> </html>

      

+3


source to share


1 answer


Before moving on to fetching the interaction in import.io, I always test it locally on the desired website using custom JavaScript and the CSS chrome extension .



Maybe this can help you.

0


source







All Articles