Note that there are some explanatory texts on larger screens.

plurals
  1. POBasic AJAX GET call with AngularJS
    primarykey
    data
    text
    <p>I'm writing a Chrome extension using Angular JS. I need to load a HTML page from a third party site and parse it.</p> <p>Using <a href="http://docs.angularjs.org/api/ngResource.%24resource" rel="nofollow">Angular JS $resource</a> (is this there a better way?) I get some weird object with every character of the HTML page being one property of the object:</p> <pre><code>g {0: "&lt;", 1: "!", 2: "D", 3: "O", 4: "C", 5: "T", 6: "Y", 7: "P", 8: "E", 9: " ", 10: "h", 11: "t", 12: "m", 13: "l", 14: " ", 15: "P", 16: "U", 17: "B", 18: "L", 19: "I", 20: "C", 21: " ", 22: """, 23: "-", 24: "/", 25: "/", 26: "W", 27: "3", 28: "C", 29: "/", 30: "/", 31: "D", 32: "T", 33: "D", 34: " ", 35: "X", 36: "H", 37: "T", 38: "M", 39: "L", 40: " ", 41: "1", 42: ".", 43: "0", 44: " ", 45: "T", 46: "r", 47: "a", 48: "n", 49: "s", 50: "i", 51: "t", 52: "i", 53: "o", 54: "n", 55: "a", 56: "l", 57: "/", 58: "/", 59: "E", 60: "N", 61: """, 62: " ", 63: """, 64: "h", 65: "t", 66: "t", 67: "p", 68: ":", 69: "/", 70: "/", 71: "w", 72: "w", 73: "w", 74: ".", 75: "w", 76: "3", 77: ".", 78: "o", 79: "r", 80: "g", 81: "/", 82: "T", 83: "R", 84: "/", 85: "x", 86: "h", 87: "t", 88: "m", 89: "l", 90: "1", 91: "/", 92: "D", 93: "T", 94: "D", 95: "/", 96: "x", 97: "h", 98: "t", 99: "m"…} </code></pre> <p>This is my resource interface definition:</p> <pre><code>[...] factory('search', function($resource) { return $resource('http://www.example.net/search/:title'); }). [...] </code></pre> <p>This is how I use it:</p> <pre><code>var test = search.get({title: 'The King'}, function(data) { console.log(data); }); </code></pre> <p>Is there a way to receive the HTML page either as a string or a DOM tree so I can the parse it?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload