SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Site not working in IE

    I have a url that gives me various parameters I need. I've managed to get the results, but for some reason it doesn't show any results at all in IE and I'm not sure why. It works in every other browser, but just not IE. I've checked the console and there's no errors at all.

    This is what I'm using to get the results. The <head> section had this:
    Code:
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"> </script>
    <script src="js/users.js" type="text/javascript"></script>
    <script type="text/javascript">
            var imagesURL = localSt.iUrl();
    
            function call(url, parameters, callback) {
                var localTimeout = 10000;
                $("#loader").show();
                $.ajax({
                    type: 'POST',
                    url: url,
                    data: parameters,
                    timeout: localTimeout,
                    success: function(data) {
                        $("#loader").hide();
                        var obj = eval('(' + data + ')');
                        if (obj.ER) {
    
                            var header = "";
                            var msg = "Sorry there seems to be a communication error (" + obj.ER + ").<br/>Please log in again.";
                            //Error detail may be in PU
                            if (obj.ER == "103") {
                                header = obj.PU.HD;
                                msg = obj.PU.BD;
                            } else if (obj.ER == "1007") {
                                //authentcation failed                        
                                header = obj.PU.HD;
                                msg = obj.PU.BD;
                            }
    
                            $(this).attr("disabled", false);
    
                            showMessage(header, msg);
    
                        } else {
                            if (obj.PU) {
                                var msg = "";
                                var header = ""
                                if (obj.PU.HD) {
                                    header = obj.PU.HD;
                                }
                                showMessage(header, obj.PU.BD, function() {
                                    callback(data);
                                });
                            } else {
                                callback(data);
                            }
                        }
                    }
                }
    );
            }
    
            function loadtotals() {
    
                call("https://my.domain.com/server/passkey.ashx", { JL: 0 },
       function(data) {
    
           var divIdentifier;
           var obj = eval('(' + data + ')');
    
           $.each(obj.JL, function() {
    
               divIdentifier = "";
               //keys: userID,currentID,lifetimeID,total
               switch (this.userID) {
                   case 2:
                       divIdentifier = "#Jo";
                       break;
                   case 5:
                       divIdentifier = "#Fred";
                       break;
                   case 1000:
                       divIdentifier = "#Sue";
                       break;
                   case 1001:
                       divIdentifier = "#Chris";
                       break;
                   case 1002:
                       divIdentifier = "#John";
                       break;
               }
    
               if (this.userID >= 1000) {
                   switch (this.lifetimeID) {
                       case 4:
                           divIdentifier += "_0";
                           break;
                       case 5:
                           divIdentifier += "_2";
                           break;
                       case 7: case 9:
                           divIdentifier += "_3";
                           break;
                   }
               }
    
               if (this.userID == 1000) {
                   switch (this.currentID) {
                       case 0:
                           divIdentifier += "_1h";
                           break;
                       case 1:
                           divIdentifier += "_2h";
                           break;
                       case 2:
                           divIdentifier += "_3h";
                           break;
                   }
               }
               $(divIdentifier).html("" + this.total);
           });
       }
       );
            }
    
            function showApp() {
                $("#loader").hide();          
            }
    
            $(document).ready(function() {
                if (navigator.userAgent.match(/Android/i)) {
                    $("body").addClass("android");
                }
                if (navigator.userAgent.indexOf("iPhone OS") > -1) {
                    if (navigator.userAgent.indexOf("Version/5.1") > -1) {
                        $("body").addClass("iphone4");
                    }
                    $("body").addClass("iphone");
                }
                $("a").click(function(event) {
                    event.preventDefault();
                    parent.$("#newuserID").val(0);
                    window.location = $(this).attr("href");
                });
    
                loadtotals();
                showApp();
            });    
            
        </script>
    And within the <body> section I'm displaying the results by using this:
    Code:
    <div style="float: right; margin: 2px 149px 0 0;">
    <script type="text/javascript">
    document.write('<div id="Jo">');
    </script>
    <div id="Jo_0"></div>
    <div id="Jo_2"></div>
    <div id="Jo_3"></div>
    </div>
    
    <div class="clear"></div>
    
    <script type="text/javascript">
    document.write('<div id="Fred">');
    </script>
    <div id="Fred_0"></div>
    <div id="Fred_1"></div>
    <div id="Fred_2"></div>
    </div>
    
    <div class="clear"></div>
    </div>
    <div style="float: left; margin: 194px 0 0 185px;">
    <script type="text/javascript">
    document.write('<div id="Sue">');
    </script>
    <div id="Sue_0_1h"></div>
    <div id="Sue_0_2h"></div>
    <div id="Sue_0_3h"></div>
    </div>
    <script type="text/javascript">
    document.write('<div id="Sue">');
    </script>
    <div id="Sue_1_1h"></div>
    <div id="Sue_1_2h"></div>
    <div id="Sue_1_3h"></div>
    </div>
    <script type="text/javascript">
    document.write('<div id="Sue">');
    </script>
    <div id="Sue_3_1h"></div>
    <div id="Sue_3_2h"></div>
    <div id="Sue_3_3h"></div>
    </div>
    
    <div class="clear"></div>
    </div>
    </div>
    <div style="height: 80px;">
    <script type="text/javascript">
    document.write('<div id="Chris_0">');
    </script>
    <div id="Chris"></div>
    </div>
    
    <div class="clear"></div>
    
    <script type="text/javascript">
    document.write('<div id="John_0">');
    </script>
    <div id="John"></div>
    </div>
    
    <div class="clear"></div></div>
    I'd be really grateful for any help with this as I've tried everything to get it sorted, but no matter what I do it just won't work in IE

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by thehappyappy View Post
    I have a url that gives me various parameters I need. I've managed to get the results, but for some reason it doesn't show any results at all in IE and I'm not sure why. It works in every other browser, but just not IE. I've checked the console and there's no errors at all.
    It's likely that IE is caching the ajax request, so you aren't actually receiving a response from the server, but only the cached version instead.

    Try setting cache to false, to see if that if that helps to resolve the problem.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried that but it still didn't work. I've reposted my code because I've refined it a lot so it doesn't have anything unnecessary in it.
    I have a js file that is this:
    Code:
    /*jshint -W061 */
    function call(url, parameters, callback) {
        "use strict";
        $.ajax({
            type: 'POST',
            url: url,
            data: parameters,
            success: function(data) {
                callback(data);
            },
      cache: false
        }
            );
    }
    
    function loadJackpots() {
        "use strict";
        call("https://www.domain.com/passkey", { JL: 0 },
            function(data) {
                var divIdentifier, obj = eval('(' + data + ')');
                $.each(obj.JL, function() {
    
                    divIdentifier = "";
                    switch (this.gameID) {
                    case 2:
                        divIdentifier = "#snap";
                        break;
                    case 5:
                        divIdentifier = "#dominos";
                        break;
                    case 1000:
                        divIdentifier = "#chess1";
                        break;
                    case 1001:
                        divIdentifier = "#chess2";
                        break;
                    case 1002:
                        divIdentifier = "#chess3";
                        break;
                    }
    
                    if (this.gameID >= 1000) {
                        switch (this.stakeID) {
                        case 4:
                            divIdentifier += "_50c";
                            break;
                        case 5:
                            divIdentifier += "_1d";
                            break;
                        case 7:
                            divIdentifier += "_2d";
                            break;
                        case 9:
                            divIdentifier += "_2d";
                            break;
                        }
                    }
    
                    if (this.gameID === 1000) {
                        switch (this.subID) {
                        case 0:
                            divIdentifier += "_1";
                            break;
                        case 1:
                            divIdentifier += "_2";
                            break;
                        case 2:
                            divIdentifier += "_3";
                            break;
                        }
                    }
                    $(divIdentifier).html("$" + this.jackpot);
                });
            }
             );
    }
    I use this to actually load the values:
    Code:
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script><script type="text/javascript">	
             $(function() {
                loadJackpots();
            });    
            
        </script>
    And to display the results I'm using this:
    Code:
    <div id="chess1">
    				<div id="chess1_50c">$1466.85</div>
    				<div id="chess1_1d">$1641.11</div>
    				<div id="chess1_2d">$378.04</div>
    				</div>	
    			
    
    				 <div id="chess3">
    				<div id="chess3_50c">$303.86</div>
    				<div id="chess3_1d">$523.02</div>
    				<div id="chess3_2d">$1473.72</div>
    				</div>
    						
    </div>
    <div style="float: left; margin: 194px 0 0 185px;">
    				 <div id="chess2_1">
    				<div id="chess2_50c_1">$195.26</div>
    				<div id="chess2_1d_1">$154.37</div>
    				<div id="chess2_2d_1">$193.76</div>
    				</div>
    				<div id="chess2_2">
    				<div id="chess2_50c_2">$146.84</div>
    				<div id="chess2_1d_2">$119.58</div>
    				<div id="chess2_2d_2">$145.86</div>
    				</div>
    				<div id="chess2_3">
    				<div id="chess2_50c_3">$2.96</div>
    				<div id="chess2_1d_3">$19.25</div>
    				<div id="chess2_2d_3">$121.89</div>
    				</div>
    						
    </div>
    </div>
    										<div style="height: 80px;">
    				<div id="snap">
    				<div id="snap_jp">$862.16</div>
    				</div>
    							
    
    				<div id="dominos">
    				<div id="dominos_jp">$2823.18</div>
    				</div>
    I've also tried this but to no avail, it just gave me an error saying obj is undefined:
    Code:
    <div id="dominos">
    					<div id="dominos_jp">$2823.18</div>
    					<script language="javascript">
    					document.getElementById("dominos_jp").HTML=obj.JL[1].jackpot 
    					</script>
    				</div>
    Last edited by thehappyappy; May 10, 2013 at 07:46. Reason: Updated jquery version

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    4 Thread(s)
    May I please see a test page that demonstrates the problem? I would like to see if IE is resulting in an ajax response of 200 or 304 when it performs your request.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •