Reputation: 287
I would like to load data according to the body id value, here is the code:
<body id="CN">
....
<body>
and the Jquery will take the value "CN" and load content, the format of the content is below:
<div class="menu">
<div class="links">
{module_menu,1032883}
</div>
</div>
the {module_menu,1032883} is the part I want to change, value "1032883" means "CN" and I have the below array:
{module_menu,14623} for "AU"
{module_menu,1022165} for "CA"
{module_menu,1032883} for "CN"
{module_menu,1014746} for "US"
Thank you very much.
Upvotes: 1
Views: 83
Reputation: 219936
var id = document.body.id,
dict = {
AU: '{module_menu,14623}',
CA: '{module_menu,1022165}',
CN: '{module_menu,1032883}',
US: '{module_menu,1014746}'
};
dict[id] && $('.links').text( dict[id] );
Here's the fiddle: http://jsfiddle.net/9dSq8/
Upvotes: 2