| | |
AJAX/Jquery Internet Explorer error
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2009
Posts: 8
Reputation:
Solved Threads: 0
Hi guys
I was wondering whether someone could help me with a slight issue I have. I'm trying to set up a quick poll using AJAX which all works fine when using Firefox but running into issues via IE.
The issue I'm having is that although the form is being processed OK with data being captured in the database, once the form is submitted, the above script just seems to stop the rest of the page from loading. This only happens on IE and it must be something to do with the success function but as I'm new to JavaScript I don't know what I'm doing wrong.
Can anyway help me please? I think it's something really simple and I'm just being stupid.
Many thanks for reading.
I was wondering whether someone could help me with a slight issue I have. I'm trying to set up a quick poll using AJAX which all works fine when using Firefox but running into issues via IE.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
$(function() { $('.error').hide(); $(".button").click(function() { var userid = $("input#userid").val(); var name = $('input[name=name]:checked').val(); var dataString = 'name='+ name + '&userid=' + userid; $.ajax({ type: "POST", url: "poll/process.php", data: dataString, success: function() { $('#weekly_poll').html("<div id='message'></div>"); $('#message').html("<h2>Thanks for your vote!</h2>") .hide() .fadeIn(500, function() { $('#message'); }); } }); return false; }); });
The issue I'm having is that although the form is being processed OK with data being captured in the database, once the form is submitted, the above script just seems to stop the rest of the page from loading. This only happens on IE and it must be something to do with the success function but as I'm new to JavaScript I don't know what I'm doing wrong.
Can anyway help me please? I think it's something really simple and I'm just being stupid.
Many thanks for reading.
0
#2 19 Days Ago
I don't know why your specified a callback for the fadeIn, it doesn't appear to do anything. If you change success to the following, what happens ?
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
success: function() { $('#weekly_poll').html("<div id='message'></div>"); $('#message').html("<h2>Thanks for your vote!</h2>").hide().fadeIn(500); }
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
•
•
Join Date: Nov 2009
Posts: 8
Reputation:
Solved Threads: 0
0
#5 18 Days Ago
OK. Here's all the code for you:
HTML
PHP - poll/process.php
JS
Is that everything you need? Many thanks for taking the time to help.
HTML
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script language="JavaScript" type="text/javascript" src="jquery.js"></script> <script language="JavaScript" type="text/javascript" src="poll.js"></script> . . . . . . . . <div style="background-image: url(../images/poll_background_mid.gif); background-repeat: repeat-y; width: 510px;"> <div id="weekly_poll" style="padding: 5 0 0 20;"> <form name="poll" action=""> <label for="name" id="name_label">Question 1? </font> <input type="hidden" name="userid" id="userid" value="<?echo $userid;?>"/> <div style="margin: 5 0 0 0;"> <input type="radio" name="name" id="name" value="Yes" /> Yes </div> <div style="margin: 0 0 5 0;"> <input type="radio" name="name" id="name" value="No" /> No </div> <input type="submit" name="submit" class="button" id="submit_btn" value="Vote" /> </form> </div> </div>
PHP - poll/process.php
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
include("../include/session.php"); $userid = $_POST["userid"]; $answer1 = $_POST["name"]; $querypoll = ( "INSERT INTO poll (UserID, Poll, Answer1) VALUES ('$userid','Question here','$answer1')"); $resultpoll = mysql_query($querypoll);
JS
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
$(function() { $('.error').hide(); $(".button").click(function() { var userid = $("input#userid").val(); var name = $('input[name=name]:checked').val(); var dataString = 'name='+ name + '&userid=' + userid; $.ajax({ type: "POST", url: "poll/process.php", data: dataString, success: function() { $('#weekly_poll').html("<div id='message'></div>"); $('#message').html("<h2>Thanks for your vote!</h2>").hide().fadeIn(500); } }); return false; }); });
Is that everything you need? Many thanks for taking the time to help.
Last edited by calina; 18 Days Ago at 9:36 am.
0
#6 18 Days Ago
I uploaded this to my server (saved it as index.php). Appears to be working in IE7 and IE8. Can you confirm ?
php Syntax (Toggle Plain Text)
<div style="background-image: url(../images/poll_background_mid.gif); background-repeat: repeat-y; width: 510px;"> <div id="weekly_poll" style="padding: 5 0 0 20;"> <form name="poll" action=""> <label for="name" id="name_label">Question 1? </font> <input type="hidden" name="userid" id="userid" value="<?php echo $userid; ?>"/> <div style="margin: 5 0 0 0;"> <input type="radio" name="name" id="name" value="Yes" /> Yes </div> <div style="margin: 0 0 5 0;"> <input type="radio" name="name" id="name" value="No" /> No </div> <input type="submit" name="submit" class="button" id="submit_btn" value="Vote" /> </form> </div> </div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script> $(function() { $('.error').hide(); $(".button").click(function() { var userid = $("input#userid").val(); var name = $('input[name=name]:checked').val(); var dataString = 'name='+ name + '&userid=' + userid; alert(dataString); $.ajax({ type: "POST", url: "process.php", data: dataString, success: function() { $('#weekly_poll').html("<div id='message'></div>"); $('#message').html("<h2>Thanks for your vote!</h2>").hide().fadeIn(500); } }); return false; }); }); </script>
Last edited by pritaeas; 18 Days Ago at 9:43 am.
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
0
#8 18 Days Ago
I only have IETester, which shows my code snippet is working in IE6 (http://www.pritaeas.net/public/daniweb/poll/).
Could it be another part of the code ?
Could it be another part of the code ?
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
•
•
Join Date: Nov 2009
Posts: 8
Reputation:
Solved Threads: 0
0
#9 18 Days Ago
I think I may have confused you a little :s
That has never been the issue... the form submits the data to be processed and the thank you message has always shown up. The problem is that the form is at the top of the page with html code below it. When the form gets submitted in IE (version 6 is the one I've tested on) everything below the thank you message disappears. Does that make it clearer for you?
Once again.. thanks for trying to help.
That has never been the issue... the form submits the data to be processed and the thank you message has always shown up. The problem is that the form is at the top of the page with html code below it. When the form gets submitted in IE (version 6 is the one I've tested on) everything below the thank you message disappears. Does that make it clearer for you?
Once again.. thanks for trying to help.
Last edited by calina; 18 Days Ago at 10:41 am.
![]() |
Similar Threads
- Internet Explorer Error (Web Browsers)
- Internet Explorer Error (Viruses, Spyware and other Nasties)
- Internet Explorer Error Signature (Viruses, Spyware and other Nasties)
- Internet Explorer 6 Error Box (Web Browsers)
- Internet Explorer Error (Web Browsers)
- Internet Explorer - Error when listing to radio channels (Web Browsers)
- internet explorer error (Web Browsers)
- internet explorer error messages (Web Browsers)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: problem in linking pages in wordpress!!
- Next Thread: div span
| Thread Tools | Search this Thread |
acid2 ajax ajaxexample ajaxhelp ajaxjspservlets animate array automatically beta box browser captchaformproblem cart child close codes column css date debugger decimal dependent design disablefirebug dom download element embed engine enter error events ext file firefox focus form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe index java javascript javascripthelp2020 jawascriptruntimeerror jquery jsp jump libcurl listbox maps masterpage math media menu microsoft mimic mp4 onmouseoutdivproblem onmouseover onreadystatechange paypal pdf php player position post problem programming prototype redirect safari scale scriptlets scroll search security select software sql toggle unicode variables w3c web website window windowofwords \n







Once the form is submitted, all code beneath the form disappears on IE.