Показать сообщение отдельно
  #6 (permalink)  
Старый 24.03.2015, 23:03
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,072

laimas,
работает в ie,если не с инета.
Сообщение от laimas
нужен JSONP
можно поподробнее ?

и наконец танец с бубнами
<!DOCTYPE HTML>
<html>
<head>
    <title>Untitled</title>
    <meta charset="utf-8">
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script>jQuery.ajax = function (d) {
    var b = location.protocol,
        e = RegExp(b + "//" + location.hostname),
        f = "http" + (/^https/.test(b) ? "s" : "") + "://query.yahooapis.com/v1/public/yql?callback=?";
    return function (a) {
        var c = a.url;
        if (/get/i.test(a.type) && !/json/i.test(a.dataType) && !e.test(c) && /:\/\//.test(c)) {
            a.url = f;
            a.dataType = "json";
            a.data = {
                q: 'select * from html where url="{URL}" and xpath="*"'.replace("{URL}", c + (a.data ? (/\?/.test(c) ? "&" : "?") + jQuery.param(a.data) : "")),
                format: "xml"
            };
            !a.success && a.complete && (a.success = a.complete, delete a.complete);
            var b = a.success;
            a.success = function (a) {
                b && b.call(this, {
                    responseText: (a.results[0] || "").replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi, "")
                }, "success")
            }
        }
        return d.apply(this, arguments)
    }
}(jQuery.ajax);</script>
    <script>
        $(document).ready(function() {
            function Refresh() {
                 $.ajax({
                         url: 'http://tsw.ru.forexprostools.com/api.php?action=refresher&pairs=2186&timeframe=60',
                         type: 'GET',
                         success: ParseAnswer
            })};
            Refresh()
            function ParseAnswer(data) {
            data =  $('<div/>',{'html': data.responseText}).text();
            data = JSON.parse(data);
            $("#question").text(data["2186"]["summaryLast"]);;
            }
            window.setInterval(Refresh, 10000)
        });
    </script>
</head>
<body>
    <div id="question"></div>
</body>
</html>
Ответить с цитированием