KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using jQuery to submit a form when a button is clicked. I would then like to test the value of the button, however, this doesn't get submitted in Safari and Chrome. Why? Is there a work around? Test the following code in IE/FF to see that it works, and then test it in Safari/Chrome to see that it does not: ButtonPostTest.php: <?php if(isset($_POST['testBtn'])) { echo $_POST['testBtn']; } ?> <html> <head> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#btn').click(function() { $('form').submit(); // submit the form }); }); </script> </head> <body> <form action="" method="post"> <button id="btn" class="page-btn" type="submit" name="testBtn" value="Yes Button value is posted!">POST IT!</button> </form> </body> </html> UPDATE: The same thing happens with input : <input id="btn" class="page-btn" type="submit" name="testBtn" value="Post this"></input> Also, this is only an issue when submitting using jQuery .submit() - without this, it submits fine with either the button or input.
Tags (comma-separated)
Save Edits
Cancel