Trying to insert page in a div with .load on jquery
I am trying to insert a page in a div after a button click, the buttons get there text from a database.
This is the php part
PHP Code:
<?php
$test = mysql_query("SELECT item FROM items");
while ($row = mysql_fetch_array($test)){
echo '<a href="" align-left = 10px;><div class="item">'.$row['item'].'</div></a>';
}
?>
Jquery
HTML Code:
<script type="text/javascript">
$(".keuze").on('click', '.item', function(){
var $deel = $(this).text();
if ( $deel == "Statuten"){
$('#uitkomst').load('statuten.php');
}
});
</script>
<div id="uitkomst"></div> /**** Where I want the page to load ****/
Statuten is the value of the first button.
When I test with alert($deel); it gives the right value but on click it shows the page to insert for about 1 second, sometimes it works when I dubble click.
I am searching the web for a week now and cannot find the answer I need.
any ideas??
it's hard to explain because of my poor english and i am a newbie to jquery and php.