Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Adding java script in a widget WordPress

  • SOLVED

Hi,

I want to add the below java script code to my sidebar at http://www.thailandliving.se

How can I make it work in a widget?
It doesn´t work when I try with the following plugins: HTnl Java script Adder

Thanks!
Charlotte

<div id="SearchBox"> </div>
<script src="http://ajaxsearch.partners.agoda.com/partners/SearchBox/Scripts/Ago da.SearchBoxV2.js" type="text/javascript"></script>
<script type="text/javascript">
var AgodaSearch = new AgodaSearchBox({
cid: 1410906, filterCityName: '', fixedCityName: false, fixedCityNameVisible:true, hotelID: '', checkInDateBefore:3, night:2,
language:25, currencyCode: 'SEK', newWindow: false, header:http://thailandliving.se/wp-content/themes/charlotteNew/images/header.jpg '',
footer: '',
style: 'CMSLanding, Element: 'SearchBox'
}); </script>

Answers (1)

2013-01-20

Christianto answers:

Hi Charlotte,

In your site, I saw error on your site because script not loaded correctly,
there are space on your script src url, on "/Ago da"
http://ajaxsearch.partners.agoda.com/partners/SearchBox/Scripts/Ago da.SearchBoxV2.js
you can remove the space it to see if it work..
http://ajaxsearch.partners.agoda.com/partners/SearchBox/Scripts/Agoda.SearchBoxV2.js

also I see error here, some parameter missing apostrophe (') on its value and some need to be inside apostrophe

please try use this code on widget:
[[LINK href="http://pastebin.com/0mw2a6Cw"]]http://pastebin.com/0mw2a6Cw[[/LINK]]


Charlotte Raboff comments:

Thanks! It worked :-)