Fetching a page in the background

Fetching a page in the background

Post by Chri » Wed, 08 Feb 2006 13:01:41


I'm sure there's some fancy Ajax way to do this, but I'm looking for
something simple. Is it possible to fetch a page from within a javascript
function? Basically what I want to do is allow the user to click a button to
add an item to a shopping cart *without* leaving the current page. Something
like this:

<a href="javascript:addToCart()">Click to add this thing to the cart</a>

<script>
function addToCart() {
String results =
fetchPage(" http://www.yqcomputer.com/ ");
alert(results); // shows a success or failure message
}
</script>

Unfortunately, I can't find any such fetchPage() function. Is there a
simple, cross-browser way to do the same thing?
 
 
 

Fetching a page in the background

Post by David Dorw » Wed, 08 Feb 2006 17:21:53


http://www.yqcomputer.com/


--
David Dorward < http://www.yqcomputer.com/ ; < http://www.yqcomputer.com/ ;
Home is where the ~/.bashrc is