Created
October 23, 2014 18:17
-
-
Save WebRTCGame/c87a05333f51340810bb to your computer and use it in GitHub Desktop.
Use jquery to fetch a section of another page on another domain cross site domain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="queryResultContainer">abc</div> | |
<script> | |
var ExternalURL = "www.reptilesmagazine.com/Reptile-Events-Calendar/"; | |
$(document).ready(loadContent); | |
function loadContent() { | |
var QueryURL = "http://anyorigin.com/get?url=" + ExternalURL + "&callback=?"; | |
$.getJSON(QueryURL, function (data) { | |
var element = document.getElementById("queryResultContainer"); | |
var html = $.parseHTML(data.contents); | |
html = $(html).find('#calendar-listings').html(); | |
element.innerHTML = html; | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment