Tell me, please, why such a construction refuses to work.
<body> <div id="content"> </div> </body> <script> $(function() { $('#content').load('../include/index.php'); }) </script>
The problem is that if the content from the index.php file is simply inserted into id = "content", then the jQuery methods work well, and if the content is loaded with the .load method, then many functions stop working. I know that using the method .live events retain their performance.
For example:
$('button').live('click', function() { //Действие })
But what about the functions, especially when there are a lot of them? Of course, you can load the scripts together with the loadable file, but it will not be correct, why load the scripts each time.
I just use the jQuery cookie
plugin and after downloading the content via the .load the cookie
plugin no longer works.
Tell me the solution to the problem.
.load()
intended not to load pages entirely, but to update some data without special gestures, a block of news there or a set of banners. * keep the scripts in the .js files load them through<script src=
, if you need to load the script, read$.getScript
- there is an example of how to make a caching loader. - zb '11