0

I need to create a navigation menu that can be edited separately and inserted into many html pages. Is there a way to do this using javascript / jQuery or does one have to use php? How can this be achieved?

angela
  • 1,113
  • 3
  • 16
  • 34
  • 3
    Good, your requirement is clear enough but so far what did you try? BTW yes it's possible to include a reusable _control_ but solution varies a lot according to what you're using server side (well even a plain HTML page would work if _injected_ through AJAX request). – Adriano Repetti Jan 23 '14 at 09:24

1 Answers1

0

This can be achieved with ajax, but It's easier, quicker and cleaner to do it in php.

with jquery:

$( "#navigation-container" ).load( "navigation.html" );

with php:

<? php include 'navigation.php'; ?>

To make php work you'll need a web server (such as XAMPP, MAMP, or similar)

Jonas Grumann
  • 10,438
  • 2
  • 22
  • 40