I am using jquery load a new html file, but css doesn't work -


<html>   <head>   <link rel="stylesheet" type="text/css" href="./css/public.css">   </head>   <body>      <div id="ajaxcont">         <!-- load some.html here ajax -->      </div>      <script>         $("#ajaxcont").load("some.html");      </script>   </body> </html> 

some.html looks this:

<link rel="stylesheet" type="text/css" href="./css/another.css"> <div>some contents here</div> 

but found another.css doesn't work, , console told me that:

"synchronous xmlhttprequest on main thread deprecated because of detrimental effects end user's experience. more help, check http://xhr.spec.whatwg.org/."

and want load different css file different html page, don't want put css files <head><head> in advance;

you need load jquery library make jquery work.

<html>   <head> <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>   <link rel="stylesheet" type="text/css" href="../css/public.css">   </head>   <body>      <div id="ajaxcont">         <!-- load some.html here ajax -->      </div>      <script>         $("#ajaxcont").load("some.html");      </script>   </body> </html> 

also, proper way move directory relative path 2 periods, not one:

<link rel="stylesheet" type="text/css" href="../css/public.css"> 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -