Advanced Search

Results 1 to 6 of 6

Thread: Speech Bubbles Tooltip - Error Fetching Ajax

  1. #1
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Speech Bubbles Tooltip - Error Fetching Ajax

    Speech Bubbles Tooltip
    http://www.dynamicdrive.com/dynamici...lestooltip.htm

    I've successfully installed this script into my site. However, I get an ajax error of "Error fetching Ajax content.<br />Server Response" when someone logs into the site this way:

    http://mystore.com
    as opposed to
    http://www.mystore.com

    The error appears in the form of a popup warning window when landing on the homepage.

    I'm not sure what options exist for addressing that error, so I'm here and asking! I'm hoping to find a fix that works for both URL options.

    Thank you!
    Last edited by sportbiker; 08-08-2011 at 07:55 PM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    This is blocked by browser security restrictions. You can't load ajax content from any other domain, including different subdomains (such as none and www).

    There are a few things you can do:
    1. Make sure your users are always on one or the other. This is also somewhat better for search ratings, since you don't have duplicate content.
    2. Serve the corresponding page on the same (current) domain. This can be done using relative paths rather than absolute paths. (Use /mypage.htm rather than http://mysite.com/mypage.htm) Alternatively you could dynamically generate the domain for the link (based on the current page) but that would be a lot more work.
    3. There are some very complicated ways of at least suggesting that browsers should allow cross-domain content if (and only if) you have access to both domains. But this might also require significant changes to the script. It's very hard, won't be a perfect solution, and probably is not the best choice. (It should be the best choice, but due to the current state of the web, it's impractical.)
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Aug 2004
    Posts
    9,864
    Thanks
    3
    Thanked 960 Times in 949 Posts
    Blog Entries
    15

    Default

    The script by default should convert the domain portion of your URL to the speech bubble contents to match the version that the user is currently using to browse the page ("www" or without "www"). How are you specifying this URL inside the script? Something like this?

    Code:
    jQuery(function($){ //on document.ready
     	//Apply tooltip to links with class="addspeech", plus look inside 'speechdata.txt' for the tooltip markups
    	$('a.addspeech').speechbubble({url:'http://www.mysite.com/speechdata.txt'})
    })
    DD Admin

  4. #4
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you both for your input. I understand djr33's comments and the rationale behind it. Content is served on the same domain, but I guess according to you, what you're saying is that the www. or http vs. https can affect how the script is processed.

    As far as ddadmin states, I am using relative paths and I thought I overcame the issue by using an absolute path, but then when I entered the https portion of my site, the problem was exasperated more, so I went back to relative for the moment but it still gives me that glitch. If you're curious, you can compare the results at:

    http://www.ruggedradios.com

    and compare to
    http://ruggedradios.com


    WHAT I'VE ENCODED IN MY PHP HEADER FILE:
    Code:
    <script>
    // JavaScript Document
    jQuery(function($){ //on document.ready
     	//Apply tooltip to links with class="addspeech", plus look inside 'speechdata.txt' for the tooltip markups
    	$('a.addspeech').speechbubble({url:'/Tooltip/speechdata.txt'})
    })
    </script>

    Not being a great coding expert, I'm wondering — would it help to include the actual code contained within "speechbubbles.js" in my header file rather than link to it? Would that help since all processes would be contained in the page rather than linked?

    Honestly - thanks for chiming in. It's this kind of help that's so appreciated!

  5. #5
    Join Date
    Aug 2004
    Posts
    9,864
    Thanks
    3
    Thanked 960 Times in 949 Posts
    Blog Entries
    15

    Default

    Are you saying when you use the syntax:

    Code:
    $('a.addspeech').speechbubble({url:'http://www.ruggedradios.com/Tooltip/speechdata.txt'})
    It fails when the page is accessed as http://ruggedradios.com? Theoretically it shouldn't, since as mentioned, the script should replace the domain portion of the syntax dynamically with the version currently employed by the browser, or http://ruggedradios.com (without the "www"). That then should overcome the Ajax same domain origin issue in such cases.
    DD Admin

  6. #6
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Just to clear things up in case I mis-spoke, the script for the speech bubbles works (awesome by the way!). It's just that I receive an ajax error message that's only caused when I use this script. I also want to suggest that maybe it's not the script that's in error, but perhaps a combination of this script along with other scripts that's causing the problem. But, when I do delete this script, I don't get the Ajax error; hence my question related to this script.

    The error occurs when you visit the site this way:
    http://ruggedradios.com
    versus visiting the site this way
    http://www.ruggedradios.com

    If I were to use the full path as you showed, rather than relative, the ajax error manifests again when customers move to the secure "https" checkout portion of my site. For the moment, it's easier to use the relative path, but still, it's a minor error warning I'd like to figure out. If it helps, here's the scripts in my header. Maybe it's a conflict or the order that these are sorted that's adding to the problem:

    Code:
    <script type="text/javascript" src="scripts/jquery.min.js" language="javascript"></script>
    <script type="text/javascript" src="/scripts/fadeslideshow.js"></script>
    <script type="text/javascript" src="js/prototype.js"language="javascript"></script>
    <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"language="javascript"></script>
    <script type="text/javascript" src="js/lightbox.js"language="javascript"></script>
    <script type="text/javascript" src="/scripts/swapimage.js"language="javascript"></script>
    <script type="text/javascript" src="Tooltip/speechbubbles.js" language="javascript"></script>
    <script>
    // JavaScript Document
    jQuery(function($){ //on document.ready
     	//Apply tooltip to links with class="addspeech", plus look inside 'speechdata.txt' for the tooltip markups
    	$('a.addspeech').speechbubble({url:'/Tooltip/speechdata.txt'})
    })
    </script>

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
  •