Jump to content

javascript function help


aliento

Recommended Posts

I have this link

<a href="javascript:ajaxpage(\'../index/php/load_menu.php?page='.$pages['label'][$i].'&language='.$language.'\', \'menu\'); ajaxpage(\'../index/php/load_content.php?page_id='.$pages['id'][$i].'\', \'content\'); "  >

 

I want to put it all together to a function.

Can be done?

Link to comment
https://forums.phpfreaks.com/topic/128986-javascript-function-help/
Share on other sites

assuming ajaxpage is already working:

 

in the HEAD tag:

<script type="text/javascript">
function load_content (languge,page_label,page_id) {
  ajaxpage('../index/php/load_menu.php?page='+page_label+'&language='+languge, 'menu');
  ajaxpage('../index/php/load_content.php?page_id='+page_id, 'content');
}
</script>

 

then in your page:

<?php
print '<a href="javascript:load_content(\''.$language.'\',\''.$pages['label'][$i].'\',\''.$pages['id'][$i].'\'); ">';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.