Results 1 to 3 of 3

Thread: Ajax tootip - problem with ajax syntax?

  1. #1
    Join Date
    Apr 2017
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Ajax tootip - problem with ajax syntax?

    Hello,

    I'm working with this script: Ajax Tooltip http://www.javascriptkit.com/script/...xtooltip.shtml .

    Within the same domain, it works properly. But when I write a different domain URL as source, it doesn't, although I have granted CORS permissions on that other domain.

    Example:
    Code:
    <a class="showTip" href="#INFO" title="ajax:../00/page1.htm">page 1</a>
    works,

    but neither
    Code:
    <a class="showTip" href="#INFO" title="ajax:http://www.example.com/page2.htm">page 2</a>
    nor
    Code:
    <a class="showTip" href="#INFO" title="ajax:www.example.com/page2.htm">page 2</a>
    work.

    What I am doing wrong?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well the access control is key, but as long as that's set properly on the remote page, the script syntax splits the title attribute on : and uses the second segment. So your first non-working example is seen as just "http" and the second one is missing the protocol (needed for all off site links), so won't work either.

    However, as long as the protocol is the same as the local page, you can use '//' to imply it:

    Code:
    <a class="showTip" href="#INFO" title="ajax://www.example.com/page2.htm">page 2</a>
    In general this will only work on a live page (or a local host server that uses the same protocol as the requested page), and only if both the requesting page and the requested page are the same protocol (both http: or both https:).

    NOTE: Untested, but should work. The browser cache may need to be cleared, and/or the page refreshed to see results.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    Rainymountain (04-05-2017)

  4. #3
    Join Date
    Apr 2017
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    John, many thanks, it works!

    (Am I stupid! Something actually told me that the http: was too much and the www. too less, but I wasn't thinking of the //. The tree hiding the forest. )

Similar Threads

  1. Replies: 5
    Last Post: 08-09-2012, 12:10 PM
  2. I have 3 Qs about web-service/ajax(1,2) and syntax meaning(3)
    By leonidassavvides in forum JavaScript
    Replies: 8
    Last Post: 03-21-2010, 05:40 AM
  3. DD ajax tabs: ajax form submit problem
    By crooky in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 04-29-2009, 02:18 PM
  4. [Ajax] Ajax Messages (Ajax Demonstration)
    By iMarc in forum Submit a DHTML or CSS code
    Replies: 2
    Last Post: 03-22-2007, 03:31 AM
  5. Replies: 2
    Last Post: 01-13-2006, 05:06 PM

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
  •