Smashden Posted October 6, 2015 Share Posted October 6, 2015 Hello, I have a script in JS which makes that when you click on <li> shows include PHP in DIV(load after the page loads). I want to include PHP file when I click and show it. How can I do it in AJAX? Look at me code: <ul class="task-menu" style="width: 200px;"> <li class="account_buttons" data-target=".option1">Create Character</li> <li class="account_buttons" data-target=".option2">Delete Character</li> <li class="account_buttons" data-target=".option3">Change Password</li> <li class="account_buttons" data-target=".option4">Change Email</li> <li class="account_buttons" data-target=".option5">Create Guild</li> </ul> <script> $(document).ready(function () { var $targets = $('.target'); $('.task-menu .account_buttons').click(function () { var $target = $($(this).data('target')).toggle(600); $targets.not($target).hide(800) }); }); </script> This I have on botttom my page: <div class="option1 target" style="display: none;"> <hr class="account_edit"> <?php include ("modules/option1.php"); ?> -- here I want to include when I click on option1 <script src="javascript/option1_script.js"></script> </div> <div class="option2 target" style="display: none;"> <hr class="account_edit"> <?php include ("modules/option2.php"); ?> -- here I want to include when I click on option2 <script src="javascript/option2_script.js"></script> </div> <div class="option3 target" style="display: none;"> <hr class="account_edit"> <?php include ("modules/option3.php"); ?> -- here I want to include when I click on option2 <script src="javascript/option3_script.js"></script> </div> <div class="option4 target" style="display: none;"> <hr class="account_edit"> <?php include ("modules/option4.php"); ?> -- here I want to include when I click on option2 <script src="javascript/option4_script.js"></script> </div> <div class="option5 target" style="display: none;"> <hr class="account_edit"> <?php include ("modules/option5.php"); ?> -- here I want to include when I click on option2 <script src="javascript/option5_script.js"></script> </div> Link to comment https://forums.phpfreaks.com/topic/298454-after-click-include-php-file-to-div/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.