Thursday 25 April 2013

Use Google Currency Converter API in JQuery

        function buildQuery(amount, from, to) {
            var str = "http://www.google.com/ig/calculator?hl=en&q=" + amount + "" + from + "%3D%3F" + to + "";
            return "select * from json where url ='" + str + "' ";
        }

        $.ajax({
            url: 'http://query.yahooapis.com/v1/public/yql',
            data: {
                q: buildQuery("100","KWD","INR"),
                format: "json"
            },
            dataType: "jsonp",
            success: function (data) {
                alert(data.query.results.json.lhs + "=" + data.query.results.json.rhs);
            },
            error: function (data) {
                consol.log(data);
            }
      });
Just change buildQuery("100","KWD","INR") parameters.

Live Demo



2 comments :

  1. Listed here you'll learn it is important, them offers the link in an helpful webpage: currency online

    ReplyDelete