views:

32

answers:

1

Well, I can't seem to figure out why this isn't working. (there is a description of the error at the bottom)

<script type="text/javascript">
$(document).ready(function(){
 $('#submit').click(function(){
  $('input[type=checkbox]:checked').each(function(){
   ajax=$.ajax({
    type: "POST",
    url: "rollcall_submitvote.php",
    data: 'division='+ $(this).val,(),
    cache: false
   }
  });
 });
});
</script>
<?php
/**
 * Include vB core.
 */ 
require_once('./global.php');
require_once(DIR . '/includes/functions_bigthree.php');
require_once(DIR . '/includes/functions_forumlist.php');

/**
 * Grab the divisions from the database.
 */
$query = $db->query_read("SELECT division FROM rollcall_divisions");
while($array = $db->fetch_array($query)){
 echo "<input type='checkbox' value=".$array[division].">".$array[division]."<br>";
}
?>
<input type="submit" id="submit">

Here is the submit vote page:

<?php
/**
 * Include vB core.
 */ 
require_once('./global.php');
require_once(DIR . '/includes/functions_bigthree.php');
require_once(DIR . '/includes/functions_forumlist.php');

$db->query_write("INSERT INTO rollcall_users VALUES ('".$_POST["division"]."', '".$vbulletin->userinfo['username']."')")or die(mysql_error());
?>

If I go to the submit vote page it puts a record with an empty result and the username in the database. But if I click submit nothing ever gets added.

+1  A: 
$(document).ready(function(){
 $('#submit').click(function(){
  $('input[type=checkbox]:checked').each(function(){
   ajax=$.ajax({
    type: "POST",
    url: "rollcall_submitvote.php",
    data: 'division='+ $(this).val,(),
    cache: false
   });
  });
 });
});

Didn't see the error message but you are missing ); to close the ajax call.

Louis
Thanks, that was the problem.
Arimil
No worries. Could you accept it as the answer please :)
Louis
I was waiting for the timer, done now.
Arimil