0

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 Answer 1

1
$(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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, that was the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.