I'm working on a small project and I've never used Jquery before. I would like to know if I'm on the right way before taking more steps.
This is basicly my UI:
<ul id="Navigation">
<li id="HomeButton">Home</li>
<li id="NewsButton">News</li>
<li id="AboutUsButton">AboutUsButton</li>
</ul>
<div id="Content"></div>
<script type="text/javascript">
$("#HomeButton").on("click", function(){
$("#Content").load("pages/home.php");
});
$("#NewsButton").on("click", function(){
$("#Content").load("pages/news.php");
});
$("#AboutUsButton").on("click", function(){
$("#Content").load("pages/asbout_us.php");
});
</script>
Is this right way to build a dynamic jquery UI?
This is basicly how I do database related stuff:
File name of an action:
clear_inventory.php
This code sets inventory slots to 0 in a database table and echo's the result.
UI related to action:
<button id="ClearInventoryButton">Clear Inventory</button>
<div id="ClearInventoryResult"></div>
<script type="text/javascript">
$("#ClearInventoryButton").one("click", function(){
$("#ClearInventoryResult").load("actions/clear_inventory.php");
});
Is this right / secure way to do it?
Thanks for your answers in advance.
Sorry if the question was asked before.