Using SkyScanner's white label API, I'm trying to add the following to a Wordpress webpage...
The code works fine when placed into the body of a simple webpage. Can anyone let me know how to get it to work in a WordPress page? I'm creating/editing the page via wp-admin. I'm using a standard template.
Thanks in advance.
<div id="wl-container"></div>
<script>
(function (s, k, y) {
var l = s.createElement("script");
l.src = k + "/js/client.js"; l.async = 1;
l.onload = function () { y({ serviceBase: k }); };
var t = s.getElementsByTagName("head")[0]; t.appendChild(l);
})(document, "//whitelabel.api.skyscanner.net", myCallback);
function myCallback(options) {
var whitelabel = new Skyscanner.Flights.Whitelabel({
serviceBase: options.serviceBase,
customerId: "testwl46"
});
whitelabel.create("wl-container", {
market: "UK",
locale: "en-GB",
currency: "GBP",
originPlace: "EDI",
destinationPlace: "LON",
outboundDate: "2014-03-10",
inboundDate: "2014-04-10"
});
}
</script>
I finally manage to get this to work by being very careful with the indenting, spaces and line breaks when entering the javascript within the wordpress page editor