SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trying To Load Data From Other Server...

    Hey,

    You know how Google Analytics or Google Adsense lets you copy and paste javascript to your site and you can load data/track visitors/etc. Well, I want to do the same thing for my customers, on their domains, where they load dynamic prices on my server (long story).

    Is $getJSON the best solution in this day and age? I would prefer to not force them to use frames and I am not worried (nor are they, for reasons I wont' get into) about users who don't use javascript.

    In short, our site processes payments for them and there is a unique feature that offers dynamic prices. So if they have javascript code with an order button image, I want them to hit my server and have their javascript code read my server, find the updated price, and display it to their user.

    Besides getJSON, what other solutions would you use? Would image src with a php page be appropriate?

    Please note they will be using .html pages, not php, and they are not programmers and I want to simplify it. I am just wondering if my idea of getJSON is the most efficient/logical solution.

    Thanks

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Seems sensible to me. Make sure you follow the docs to ensure the code will run across domains. An image would be less desirable as it won't look as good and users can't select the text.

  3. #3
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the reply. If I may, I just had one last question.

    The price is dynamic and we were thinking of using a personalization token, such as {price} so we can update it each time a user requests the JSON feed. For instance, at 5PM it might be $9.97 but in an hour $10.37...

    So I was wondering if it makes sense to handle the token personalization on the MAIN server instead of having users copy/paste jscript code with tokens/etc. The other question is if the user should only be copying pasting code that offers:

    A.) getJSON function to retrieve current price from main server

    B.) A 'silent refresh' that hits the server every 10-20 seconds for the updated price.

    Logically, does my plan make the most sense in terms of being efficient and getting the job done?

    Thanks. I will do the work and research, I just wanted to see if I was overlooking any logic 'pitfalls.

  4. #4
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ignore. I am thinking too much. Was an idea a client had but I realize it's just important to hit the server with the proper querystring (user_id&product_id) and get the value via JSON each time the page loads or each time a 'silent refresh' hits

    Ty for your time.


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
  •