this is just the basic html of my code, my js file is included. my php file works.. i echo an alert and it says you voted. that works when visiting the php page by itself.
the problem is the page refreshes...
<div class='up'>[url=""]1 Good[/url]</div>
<div class='down'>[url=""]2 Bad[/url]</div>
<div class='up'>[url=""]1 Good[/url]</div>
<div class='down'>[url=""]2 Bad[/url]</div>
my JS stuff
$(document).ready(function ()
{
$(".vote").click(function()
{
var id = $(this).attr("id");
var name = $(this).attr("name");
var dataString = 'id='+ id ;
var parent = $(this);
if(name=='up')
{
$.ajax(
{
type: "POST",
url: "ajax/voteGood.php",
data: dataString,
cache: false,
success: function(html)
{
parent.html(html);
}
});
}
else
{
$.ajax(
{
type: "POST",
url: "ajax/voteBad.php",
data: dataString,
cache: false,
success: function(html)
{
parent.html(html);
}
});
}
})
})