By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,776 Members | 1,400 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,776 IT Pros & Developers. It's quick & easy.

Fetching a page in the background

P: n/a
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://mysite.com/addToCartPage.jsp?item-number=123");
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?
Feb 7 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Chris" <anon> wrote:
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?


http://jibbering.com/2002/4/httprequest.html
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Feb 7 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.