I have a need to display a cross-domain webpage in a nav-tab content box. I am using the "whatever origin" example explained in this link
Loading cross domain endpoint with jQuery AJAX
and my HTML code looks like this:
<section class="local-market-stats">
<div id="market-condition-chart-wrap">
<ul class="nav nav-tabs" id="myTabs">
<li class="active"><a data-toggle="tab" href="#cc">CC</a></li>
<li><a data-toggle="tab" href="#fm">FM</a></li>
<li><a data-toggle="tab" href="#et">ET</a></li>
<li><a data-toggle="tab" href="#bs">BS</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="cc">
<div></div> <!-- the external page content displays here -->
</div>
<div class="tab-pane" id="fm">
</div>
<div class="tab-pane" id="et">
</div>
<div class="tab-pane" id="bs">
</div>
</div><!-- end tab-content -->
</div><!-- end market-condition-chart-wrap -->
</section><!-- end local-market-stats -->
Ajax Code:
$.ajaxSetup({
datatype : "html",
contentType: "application/x-www-form-urlencoded; charset=UTF-8"
});
$.getJSON('http://whateverorigin.org/get?url=' + encodeURIComponent('http://www.marketrendspremium.com/share/v1/e/cmlkPTEmZnRpZD0yJmZpZD0xMDAwJmd0eT0xMiZsdGlkPTQmbGlkPTk5OTk5JmdpZD0wJmNjPTAwMDBkZCZzaWQ9MCZtaWQ9MCZ0dD0yJm1vZGU9MiZ3aWR0aD01NDAmaGVpZ2h0PTMzMCZtbHNpZD0wJmN0eT1tbHM=')
+ '&callback=?',
function(data) {
$('#cc div').html(data.contents);
});
Nothing was displayed as a result, but if I switch it back to encodeURIComponent('http://google.com') it works just fine. I really don't need to encode the url as the link should display just like that, but it still doesn't work even I removed encodeURIComponent().
Any advice is greatly appreciated!