trigger won't work in IE
trigger won't work in IE
Hi,
I'm using trigger in an ajax call to move the 1st tab to the 2nd tab(the result). It is working in firefox, but not IE(6-8)
Where did I get wrong?
Thanks
Here is my code:
The main HTML
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>Tabbed Poll</title>
- <link type="text/css" href="css/style.css" rel="stylesheet" />
- <link type="text/css" href="css/custom-theme/jquery-ui-1.8.4.custom.css" rel="stylesheet" />
- <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
- <script type="text/javascript" src="js/jquery-ui-1.8.4.custom.min.js"></script>
- <script type="text/javascript">
- $(function(){
- $('#tabs').tabs();
- });
- </script>
- <script type="application/javascript" src="js/script.js"></script>
- </head>
- <body>
- <div id="tabs">
- <ul>
- <li><a href="poll_display.php">Declaration of Faith</a></li>
- <li><a href="view_poll_result.php" id="viewresult">View Results</a></li>
- </ul>
-
- </div>
- <p id="msgerror" style="display:none;">Please select an answer</p>
- </body>
- </html>
The part of the script where the trigger lies
- $.ajax
- ({
- type: 'post',
- url: 'view_poll_result.php',
- data: 'opt=' + opt +'&'+'qst_id=' +qst_id +'&'+ 'name=' + name +'&'+'email=' + email,
- success: function(data)
- {
- $('#viewresult').trigger('click');
- $.ajax
- ({
- type: 'post',
- url: 'email.php',
- data: 'opt=' + opt +'&'+'qst_id=' +qst_id +'&'+ 'name=' + name +'&'+'email=' + email,
- });
- opt = '';
- qst_id = '';
- name = '';
- email = '';
- }
- });//end of ajax
- return false;
- });
The complete script script
- $(document).ready(function()
- {
- var opt;
- $('#opt1').live('click',function()
- {
- opt = $('#opt1').val();
- });
- $('#opt2').live('click',function()
- {
- opt = $('#opt2').val();
- });
-
- $('#poll').live('submit',function()
- {
- var qst_id = $('#qst_id').val();
- var name = $('#name').val();
- var email = $('#email').val();
- if ((opt != 'Yes')&&(opt != 'No'))
- {
- //Error message
- $('#msgerror').dialog
- ({
- autoOpen: true,
- title: 'Declaration of Faith',
- height: 250,
- modal: true,
- resizable: false,
- draggable: false,
- dialogClass: 'alert',
- buttons: {
- "Ok": function()
- {
- $(this).dialog("close");
- $('body').css(
- {'overflow': 'auto',
- 'height' : 'auto',
- 'width' :'auto'
- });
- }
- }
- })
- return false;
- }
-
- $.ajax
- ({
- type: 'post',
- url: 'view_poll_result.php',
- data: 'opt=' + opt +'&'+'qst_id=' +qst_id +'&'+ 'name=' + name +'&'+'email=' + email,
- success: function(data)
- {
- $('#viewresult').trigger('click');
- $.ajax
- ({
- type: 'post',
- url: 'email.php',
- data: 'opt=' + opt +'&'+'qst_id=' +qst_id +'&'+ 'name=' + name +'&'+'email=' + email,
- });
- opt = '';
- qst_id = '';
- name = '';
- email = '';
- }
- });//end of ajax
- return false;
- });
- });