Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I access the transferred contents from a cross-domain getScript() AJAX request?
    primarykey
    data
    text
    <p>I am using the jQuery (1.7.2) getScript() AJAX method to fetch an external (cross-domain) HTML page which contains embedded javascript. I am using the 'script' data type for the getScript() command because it has no cross-domain restrictions. In the browser's JS console, I use the following code which is equivalent to a getScript() request:</p> <pre><code>$.ajax({ url: url, // This url is for an HTML page with embedded JS - not for a JS file type: 'get', crossDomain: true, dataType: 'script', beforeSend: function(result) { result.setRequestHeader('Accept', '*/*') }, success: function(result) { console.log('SUCCESS:\t' + result) }, error: function(result) { console.log('ERROR') }, complete: function(result) { console.log('COMPLETE:\t' + result.responseText) } }) </code></pre> <p>This returns with 'success', but no result.</p> <pre><code>SUCCESS: undefined COMPLETE: undefined </code></pre> <p>The console also tells me that the content was interpreted as a script but transferred with MIME type text/html (I suppose this is because the url I'm using is for an HTML page). I know the entire HTML data was transferred to the client because I can access it using the browser JS console's network panel, and I can confirm that the correct number of KBs was indeed transferred.</p> <p>I'm not sure I'm concerned about the MIME message because I really just need to get my hands on the transferred content and do some parsing. How can I access this transferred content - which is somewhere on the client side - using jQ/JS? If I can't get to it, how is it that the browser console's network panel has access to it?</p>
    singulars
    1. This table or related slice is empty.
    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.
    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