Hey guys I’m not getting any post data coming out here, and am pretty positive this isn’t working at all. The big deal was it firing a accept/deny with an id # attached, and a value for that forms checkbox. I’m getting no errors, and no warnings so am having an issue stepping through it =( Hopefully another set of eyes?
Sorry ahead of time I know my JQuery blows.
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.6");
</script>
<script>
$(".audit").submit(function()
{
return false;
});
$(".accept, .deny").click(function(event)
{
$form = $(this).parent("form").get(0);
$gruden = $form(function(index) { attributes.push($(this).val());});
$.post($form.attr("action"), $form.serialize() + "&submit=" + $(this).attr("value") + "&gruden=" + $gruden, function(data) {
console.log(data);
});
});
</script>
.......................
<?php foreach($obj->photos as $pending) { ?>
<div class='container' id='photo-<?=$pending->id;?>'>
<span class='shadow'>
<a href='/<?=$pending->large;?>'><img src='http://<?=$_SERVER['HTTP_HOST'].'/'.$pending->small;?>'/></a>
</span>
<form class='audit' name='audit-<?=$pending->id;?>' action='<?=$_SERVER['PHP_SELF'];?>'>
<div class='box'>
<ul>
<li>ID: <?=$pending->id;?></li>
<li>Date: <?=$pending->created_at;?></li>
<li>User: <?=$pending->fb_id;?></li>
<li> </li>
<li>
<input class='gruden' value='gruden-<?=$pending->id;?>' type='checkbox' />
<a name='submit' value='accept-<?=$pending->id;?>' class='accept' href=''></a>
<a name='submit' value='deny-<?=$pending->id;?>' class='deny' href=''></a>
</li>
</ul>
</div>
</form>
</div>
<?php } ?>
I think I see your problem now. I’ve re-written your code so it makes more sense. Comments to explain what’s going on
No offense, but I think you might benefit from reading a bit more about Javascript and jQuery. At least read up on how selectors work in jQuery, and some basic Javascript syntax