Collect Data From Another Site Using Javascript
I am trying to build a calculator that will have to pull data from another site. For example, if the user on my site selects the currency 'BRL', I want to collect the rate '3.04' f
Solution 1:
You cannot do it because the security restriction BUT on your site you create load.php file with the code:
<?php$content = file_get_contents("http://dev.zionsfx.com/FXLiveRateStream4.asp");
echo$content;
and js code
$.ajax({
type: "POST",
url: "http://yourSiteUrl/load.php",
}).done(function( result ) {
var tab = $(result).find('tr[title="Brazilian Real"]') .find('td:eq(1)');
console.info(tab.text())
});
the code is not really nice but it does what you wanted. So you can improve it in your free time
Solution 2:
This link can help you to get the html from a url: james.padolsey.com/javascript/cross-domain-requests-with-jquery
And also this link can help you to get the content from the td with "BRL" content: JQuery select all rows containing certain text within a td in the row
Hope it helps.
Post a Comment for "Collect Data From Another Site Using Javascript"