...

View Full Version : Resolved Javascript Pricewatch



conware
12-21-2010, 11:17 AM
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.

Philip M
12-21-2010, 12:24 PM
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.

conware
12-21-2010, 06:42 PM
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. :p

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:


function Call()
{
// run code
}


But the author wrote:


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.

Old Pedant
12-21-2010, 08:26 PM
For your simple example, there's no difference.

The second form is used a lot in creating pseudo-classes, because you can make the


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


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.

conware
12-21-2010, 08:30 PM
For your simple example, there's no difference.

The second form is used a lot in creating pseudo-classes, because you can make the


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


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:


var f1 = new Function("return 3.1415;");


Thanks for the example and the info :)

Philip M
12-21-2010, 08:43 PM
Thats pretty cool. Also I didnot know you could do that:


var f1 = new Function("return 3.1415;");


Thanks for the example and the info :)

That is really no different from

function addem(a,b) {
c = a + b;
return c;
}

var f1 = addem(10,3);
alert (f1);

Old Pedant
12-21-2010, 08:58 PM
Yep. That poor skinless cat.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum