javascript - Loading dynamic contents when a div is clicked -
i hope can me this. use dynamic call server content needs loaded div.
there fixed menu @ bottom of page when tag clicked calls function , tells frame update, , in function generates xmlhttprequest (or use activex in case of old ie versions etc.), request navigate predefined location on server php snippet lies needs included, , set innerhtml of corresponding output section.
i array outside of function keeps track of pages have been loaded, doesn't load page again because user clicks on link second time.
html:
<div id="fixedmenu"> <input type="radio" name="radio-set" checked="checked" id="main"/> <a href="#1">main</a> <input type="radio" name="radio-set" id="2nd"/> <a href="#2">2nd</a> <input type="radio" name="radio-set" id="3rd"/> <a href="#3">3rd</a> <input type="radio" name="radio-set" id="4th"/> <a href="#4">4th</a> <input type="radio" name="radio-set" id="4th"/> <a href="#5">4th</a> </div> <div class="scroll"> <section class="main"> <!-- loads main context. --> </section> <section id="2nd" > <!-- section should load php file when button clicked. --> </section> <!-- section 3rd - 5th... --> </div>
javascript
<script> $(document).ready(function(){ $("#2").click(function(){ $("#2nd").load('myurl'); }); }); </script>
is there chance can put php file in same folder here instead of directing function url?
you should able this:
$("#2nd").load('/path/to/my/php/page/here');
have tried that
Comments
Post a Comment