javascript - Including HTML page within HTML Page using jQuery -


i including html page, named test.html in webpage. below:

<head>   <meta charset="utf-8">   <title>load demo</title>   <script src="https://code.jquery.com/jquery-1.10.2.js"></script> </head> <body>  <b>content want include here: </b> <div id="success"></div>   <script> $( "#success" ).load( "test.html", function( response, status, xhr ) {   if ( status == "error" ) {     var msg = "sorry there error: ";     $( "#success" ).html( msg + xhr.status + " " + xhr.statustext );   } }); </script>  </body> </html> 

i error reading:

sorry there error: 0 networkerror: failed execute 'send' on 'xmlhttprequest': failed load 'file://machd/.../html/test.html'.  

what error mean? , how best solve it?

you can make use of angular js including html file

read docs here

https://docs.angularjs.org/api/ng/directive/nginclude

example:

<div class="container">   <div ng-include="'filename.htm'"></div> </div> 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -