AJAX Beginner: If then statement

Posted by dassouki on Stack Overflow See other posts from Stack Overflow or by dassouki
Published on 2010-03-18T16:40:04Z Indexed on 2010/03/18 16:41 UTC
Read the original article Hit count: 334

Filed under:
|

In menu.html, I have my menu items(a href links), let's call them, menu_1, menu_2, ....

In map.js displays the contents of a map, it calls an API to display some layers and maps. I have a lot of maps to show but i only want to call the api once.

Using AJAX, I was wondering if it's possible to have an if/then or select/case in my js, so that if menu_1 is clicked, then implement map_1 etc. without having the page to reload. The only way I thought I could do this is using Post/get .. so when you click on menu_1 it takes you to page.php?page_id=1 . JS will read that and display the map.

I'm new to JS and AJAX so please feel free to butcher me

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about JavaScript