Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-21-2010, 10:17 AM   PM User | #1
conware
Regular Coder

 
Join Date: Mar 2010
Posts: 195
Thanks: 77
Thanked 5 Times in 5 Posts
conware is an unknown quantity at this point
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..
conware is offline   Reply With Quote
Old 12-21-2010, 11:24 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,098
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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..
Philip M is offline   Reply With Quote
Users who have thanked Philip M for this post:
conware (12-21-2010)
Old 12-21-2010, 05:42 PM   PM User | #3
conware
Regular Coder

 
Join Date: Mar 2010
Posts: 195
Thanks: 77
Thanked 5 Times in 5 Posts
conware is an unknown quantity at this point
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.
conware is offline   Reply With Quote
Old 12-21-2010, 07:26 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,542
Thanks: 62
Thanked 4,054 Times in 4,023 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
conware (12-21-2010)
Old 12-21-2010, 07:30 PM   PM User | #5
conware
Regular Coder

 
Join Date: Mar 2010
Posts: 195
Thanks: 77
Thanked 5 Times in 5 Posts
conware is an unknown quantity at this point
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
conware is offline   Reply With Quote
Old 12-21-2010, 07:43 PM   PM User | #6
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,098
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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);
Philip M is offline   Reply With Quote
Old 12-21-2010, 07:58 PM   PM User | #7
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,542
Thanks: 62
Thanked 4,054 Times in 4,023 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:13 AM.


Advertisement
Log in to turn off these ads.