1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Google map won't display without refresh.

Discussion in 'jQuery' started by wayne Xuan, Jun 19, 2014.

  1. #1
    Google map not working till refresh

    web address: http://mobile.smartagent.co.nz/users/348/properties

    when you click on the properties, the map can't display, it will display if you refresh the page.
    any idea why and how to fix it
    thanks in advance!
     
    wayne Xuan, Jun 19, 2014 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    I imagine that if you tackle these errors you'll probably fix the problem at the same time
    upload_2014-6-20_15-22-51.png
     
    sarahk, Jun 19, 2014 IP
  3. wayne Xuan

    wayne Xuan Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    Thanks for reply, but I have no idea where should I look at the problems?
     
    wayne Xuan, Jun 19, 2014 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #4
    Look at the javascript console and find the missing file - and get that link sorted out. Then refresh and check the new errors.
     
    sarahk, Jun 19, 2014 IP
  5. wayne Xuan

    wayne Xuan Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    Hi there, all the problem you mention sorted, but still got the same problem, can not show the map unless refresh
    any more help please?
     
    wayne Xuan, Jun 26, 2014 IP
  6. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #6
    I'm still finding errors in the console
    upload_2014-6-27_13-58-22.png
     
    sarahk, Jun 26, 2014 IP
  7. wayne Xuan

    wayne Xuan Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #7
    I don't know how to fix them
    undefined is not a function, no idea where is the undefined
    photoswipe for the photos slideshow, it working fine on the website
    initialize is not defined, it working ok on html using the same script within the <body>. no idea why need define on jquery
     
    wayne Xuan, Jun 26, 2014 IP
  8. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #8
    doing the digging for you... I looked at line 56 of your source and find this

    <script type="text/javascript">
    $('a').live('click', function() {
    var $this = $(this);
    if ( !$this.attr('rel') || $this.attr('rel') != 'external' )
    $(document.getElementById( $this.attr('href') )).remove();
    });
    </script>
    Code (markup):
    I would suggest it should have a document ready wrapped around it

    <script type="text/javascript">
    $( document ).ready(function() {
       $('a').live('click', function() {
          var $this = $(this);
          if ( !$this.attr('rel') || $this.attr('rel') != 'external' )
             $(document.getElementById( $this.attr('href') )).remove();
          });
    });
    </script>
    Code (markup):
    Why is the document ready inside a function in this?
    
    (function(window, $, PhotoSwipe)
    {
    $(document).ready(function()
    {
    $("#gallery a").photoSwipe(
    {
    enableMouseWheel: false,
    enableKeyboard: false
    });
    $("#gallery a:first").click();
    });
    }(window, window.jQuery, window.Code.PhotoSwipe));
    
    Code (markup):
     
    sarahk, Jun 26, 2014 IP
  9. wayne Xuan

    wayne Xuan Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #9
    the script you mention is for photoswipe, I did change to have a document ready wrapped around it, but nothing change,
    I also deleted both script you mention that will affect the map, now the map still can't display
    could you have another digging for me please? if you go to the website again now, it won't have those script there .
     
    wayne Xuan, Jun 26, 2014 IP
  10. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #10
    You should have probably fixed your code rather than just removing it.

    You still get an error with
    <body style="margin:0px; padding:0px;" onload="initialize()">
    Code (markup):
    Is initialize meant to initialize the maps?

    when I click on a property I get this error
    Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened. js?sensor=false&_=1403840728457:8
    Code (markup):
    That relates to this code
    function getScript(src) {
        document.write('<' + 'script src="' + src + '"' +
                       ' type="text/javascript"><' + '/script>');
      }
    Code (markup):
    I'm not a jquery expert but I do know that it offers 2 vastly superior ways to load scripts. So long as you've got it loaded you might as well use it
    var scriptpathandname = '/folder/file.js';
    $.ajax({
                url: scriptpathandname,
                dataType: "script",
                cache: true
            }).done(function() {
    
                console.log( 'Done: '+scriptname); // Success
            });
    Code (markup):
    or
    
    $.getScript( "/folder/file.js", function( data, textStatus, jqxhr ) {
                    console.log( textStatus ); // Success
                    console.log( jqxhr.status ); // 200
                });
    Code (markup):
     
    sarahk, Jun 26, 2014 IP
  11. wayne Xuan

    wayne Xuan Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #11
    sorry, my level is not high enough to understand all what you say
    do you mean I got to add the script in the <head> or <body> part?
     
    wayne Xuan, Jun 26, 2014 IP
  12. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #12
    So you are just editing this code, you didn't write it?
    Are you able to get the original guy to help?
    Or hire someone locally who can come in and show you the ropes?
     
    sarahk, Jun 26, 2014 IP
  13. wayne Xuan

    wayne Xuan Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #13
    yes, I just editing the code, I get the code on line, can't find the original guy.
    that's why I try to get someone help to fix it here, I thought it's a simple fix as ithe map just need to refresh to display.
    could you give me another tips please?
     
    wayne Xuan, Jun 26, 2014 IP