0.0.0 • Published 6 years ago

mgn-getincludes v0.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

mgn-getincludes ( Don't Need jQuery )

Use XMLHttpRequest to include html files. Use this for when you can not include with php and SSI.


Install

npm i mgn-getincludes -S

Or Download raw data

↓ download "mgn-getincludes.js"


Import

import mgnInclude from 'mgn-getincludes';

Constructor

new mgnInclude( element, path [, () => {} ] );
ArgumentData typeDefaultDescroption
elementString- (Required)Specify target element.ex) ".j-include"
pathString- (Required)Insert file path.
() => {}Function-You can describe the process you want to execute after loading data here.

Property

PropertyData typeDefaultDescroption
elementString (Required)-Same as parameter.
pathString- (Required)Same as parameter.
funcFunction-Same as parameter.

Sample code

// HTML
<div id="j-include_header"></div>
// JS
import mgnInclude from 'mgn-getincludes';

new mgnInclude( "#j-include_header", "./path/to/header.html", () => {
    console.log(1);
} );