Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Mar 2010
    Posts
    199
    Thanks
    78
    Thanked 5 Times in 5 Posts

    Javascript Pricewatch

    Hi guys,

    I was wondering is it possible to make a pricewatch function with javascript?
    Lets say I wanted to display 10 ebay auctions with the lowest price from the product i wrote a review about. How would I get those auctions to display on my site. If possible of course. Also if this should be done with php ore ajax please let me know. Thanks.
    Last edited by conware; 12-21-2010 at 07:31 PM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,146
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    JavaScript is purely a client-side language, and unless used with an Ajax call has no capability to read from or write to a file (except a cookie), communicate with the server, access a database, the client's operating system or the Windows registry, or alter the default behaviour of the browser. And for security reasons JavaScript cannot access anything beyond the domain of the current page. This is known as the "same origin policy" and prevents a document or script loaded from one origin from getting or setting properties of a document from a different origin.

    In short, you would have to use server-side scripting such as PHP.

    Unless you wish to attract a swarm of expensive lawyers, you will need explicit permission to abstract data from eBay's auctions.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    Last edited by Philip M; 12-21-2010 at 11:33 AM.

  • Users who have thanked Philip M for this post:

    conware (12-21-2010)

  • #3
    Regular Coder
    Join Date
    Mar 2010
    Posts
    199
    Thanks
    78
    Thanked 5 Times in 5 Posts
    Ah I see thanks for info. I was not aware that javaScript cannot access anything beyond the domain of the current page. Make sens actually.

    Also thanks for the heads up about attracting a swarm of expensive lawyers, you will need explicit permission to abstract data from eBay's auctions.
    I saw similar site extracting data from auctions and displaying them on theire site.
    So I assumed I could not get into any trouble trying to list only the data.
    I definitely need to read more when it comes to javascript and things allowed on websites.

    Also I know this was not meant for this thread but recently I came across a javascript code.

    Basically a javascript function.
    Now the way I normally write a function is like this:
    Code:
    function Call()
    {
      // run code
    }
    But the author wrote:
    Code:
    Call = function()
    {
      // run code
    
    }
    Is there a purpose behind that ore is it just the way you like to code?
    I mean, if lets say; the second solution would load faster I'll definitely start writing my codes that way. Thanks for taking the time to reply.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,551
    Thanks
    80
    Thanked 4,490 Times in 4,454 Posts
    For your simple example, there's no difference.

    The second form is used a lot in creating pseudo-classes, because you can make the
    Code:
        var Call = function() {...}
    a member of the class more easily.

    If you look at the source code for some of the popular libraries--jQuery is an excellent example--you'll see how it's used, a lot.

    You may or may not be aware you can also do
    Code:
    var f1 = new Function("return 3.1415;");
    There are so many ways to deprive a feline of its outer integument using JavaScript that you begin to wonder where the limits are.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    conware (12-21-2010)

  • #5
    Regular Coder
    Join Date
    Mar 2010
    Posts
    199
    Thanks
    78
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by Old Pedant View Post
    For your simple example, there's no difference.

    The second form is used a lot in creating pseudo-classes, because you can make the
    Code:
        var Call = function() {...}
    a member of the class more easily.

    If you look at the source code for some of the popular libraries--jQuery is an excellent example--you'll see how it's used, a lot.

    You may or may not be aware you can also do
    Code:
    var f1 = new Function("return 3.1415;");
    There are so many ways to deprive a feline of its outer integument using JavaScript that you begin to wonder where the limits are.
    Thats pretty cool. Also I didnot know you could do that:
    Code:
    var f1 = new Function("return 3.1415;");
    Thanks for the example and the info

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,146
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    Quote Originally Posted by conware View Post
    Thats pretty cool. Also I didnot know you could do that:
    Code:
    var f1 = new Function("return 3.1415;");
    Thanks for the example and the info
    That is really no different from
    Code:
    function addem(a,b) {
    c = a + b;
    return c;
    }
    
    var f1 = addem(10,3);
    alert (f1);

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,551
    Thanks
    80
    Thanked 4,490 Times in 4,454 Posts
    Yep. That poor skinless cat.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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