newperson2008
New Member
This is in my header, jquery.min.js is already included:\[code\]<script type="text/javascript">//<![CDATA[$(function() { $("form.ajax").submit(function(e) { var $this = $(this); e.preventDefault(); $.ajax({ url: 'index.php', type: 'post', data: $this.serialize(), success: function() { //alert(response); } }) return false; });});//]]></script>\[/code\]This is an example form that is dynamically generated:\[code\]<form id="dash_73" method="post" class="ajax"> <fieldset> <input type="hidden" name="action" value="http://stackoverflow.com/questions/15823495/ajax_purchase_ticket" /> <input type="hidden" name="lottery_id" value="http://stackoverflow.com/questions/15823495/73" /> <div class="left1"> <button type="submit" name="dash" form="dash_73" id="button_73-1" value="http://stackoverflow.com/questions/15823495/1" class="ticket taken" disabled="disabled">User 1</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-2" value="http://stackoverflow.com/questions/15823495/2" class="ticket taken" disabled="disabled">User 1</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-3" value="http://stackoverflow.com/questions/15823495/3" class="ticket taken" disabled="disabled">User 1</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-4" value="http://stackoverflow.com/questions/15823495/4" class="ticket taken" disabled="disabled">User 1</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-5" value="http://stackoverflow.com/questions/15823495/5" class="ticket free">5 Dash</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-6" value="http://stackoverflow.com/questions/15823495/6" class="ticket taken" disabled="disabled">User 2</button> <br /> </div> <div class="left2"> <button type="submit" name="dash" form="dash_73" id="button_73-7" value="http://stackoverflow.com/questions/15823495/7" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-8" value="http://stackoverflow.com/questions/15823495/8" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-9" value="http://stackoverflow.com/questions/15823495/9" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-10" value="http://stackoverflow.com/questions/15823495/10" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-11" value="http://stackoverflow.com/questions/15823495/11" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-12" value="http://stackoverflow.com/questions/15823495/12" class="ticket taken" disabled="disabled">User 2</button> <br /> </div> <div class="left3"> <button type="submit" name="dash" form="dash_73" id="button_73-13" value="http://stackoverflow.com/questions/15823495/13" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-14" value="http://stackoverflow.com/questions/15823495/14" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-15" value="http://stackoverflow.com/questions/15823495/15" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-16" value="http://stackoverflow.com/questions/15823495/16" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-17" value="http://stackoverflow.com/questions/15823495/17" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-18" value="http://stackoverflow.com/questions/15823495/18" class="ticket taken" disabled="disabled">User 2</button> <br /> </div> <div class="left4"> <button type="submit" name="dash" form="dash_73" id="button_73-19" value="http://stackoverflow.com/questions/15823495/19" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-20" value="http://stackoverflow.com/questions/15823495/20" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-21" value="http://stackoverflow.com/questions/15823495/21" class="ticket taken" disabled="disabled">User 1</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-22" value="http://stackoverflow.com/questions/15823495/22" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-23" value="http://stackoverflow.com/questions/15823495/23" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-24" value="http://stackoverflow.com/questions/15823495/24" class="ticket yours" disabled="disabled">User 3</button> <br /> </div> <div class="left5"> <button type="submit" name="dash" form="dash_73" id="button_73-25" value="http://stackoverflow.com/questions/15823495/25" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-26" value="http://stackoverflow.com/questions/15823495/26" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-27" value="http://stackoverflow.com/questions/15823495/27" class="ticket yours" disabled="disabled">User 3</button> <br /> <button type="submit" name="dash" form="dash_73" id="button_73-28" value="http://stackoverflow.com/questions/15823495/28" class="ticket yours" disabled="disabled">User 3</button> <br /></div></fieldset></form>\[/code\]Currently when I click on a button to purchase a ticket, nothing occurs. I am trying to have it so when a button is pushed, it will run the code. I am still trying to work out the response method on how to retrieve a success or failure. Any help is appreciated.