I have a drop down form, which has a list of four choices the user can select from. After selecting the choice and clicking the "Advertise in Public Chat" button the option value (1, 2, 3, 4) needs to be passed to advertise.php?advertise=1 (2, 3, or 4) without the page refreshing. After clicking Advertise in Public Chat I would like a message that says "Message sent to Chat!" and the user can click OK.
My issue:
Code will not execute on Firefox or Internet Explorer (I have tried on Debian Linux & Windows PCs-- all share the same result). Works perfectly on Chrome\Opera.
<!DOCTYPE html> <html> <body> <form id="myform" action="" method="post"> <select name="Type"> <option value="1">(1 on 1)</option> <option value="2">(2 on 2)</option> <option value="3">(3 on 3)</option> <option value="4">(4 on 4)</option> </select> <input type="submit" value="Advertise in Public Chat"> </form> <div id="message"><h2>This will change when the request is sent</h2></div> <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript" ></script> <script type="text/javascript"> $(document).ready(function(event) { $('form').on('submit', function(){ event.preventDefault(); var myVal = $('select[name="Type"]').val(); $.ajax({ type: "GET", url: "advertise.php", data: { advertise: myVal } }).done(function( response ) { // response is equal to what advertise.php will echo/print $('#message h2').html("Message sent to Chat!"); }); }); }); </script> </body> </html>