I have 3 link with images. When I click on link I want add my count +1.
<a href="/home" id="push"><img src="/images/image1.gif" /></a>
<a href="/faq"> <img src="/images/image2.gif" /></a>
<a href="/news"><img src="/images/image3.gif" /></a>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
$("#push").click(function(){
$.ajax({
url: "room/room_count", type: "POST"});
});
</script>
in my controller
def room_count
count_method = Room.find 1
count_method.update_attribute(:count, count_method.count.to_i + 1)
end
If I click on link count don't update, but if I replase href="/home" on href="#" all works fine.
What am I doing wrong?
Thanks in advance