Hi,
Just a quickie hopefully.
I have developed an online shop which the client required to be accessible. So the site is fully developed in xhtml 1.1 and functions well.
I want to add the niceities that JS / AJAX can bring to tthe users experience but need a little help.
Since the target attribute is supported in the standards I have links that open in the current window if JS is off but if it is on JS can open a new window for a link. like so….
<a href=”
NOW
I want to use the same functionality with my shopping cart. So what I envisgaed was a link to add an item to the cart like so
<a href=”/online_shop/index.php?section=3&cat=1&id=2&action=additem&goto=cart2″ title=”Add Item” onclick=”changeCart(this.href); return false;” onkeypress=”changeCart(this.href); return false;”><span>Add Item</span></a>
the intention being that I split the url up in JS to take the appropriate action, update the cart using ajax and redraw the content of the cart div WITHOUT going to a new page.
However, after a bit of testing and tinkering the onclick=”changeCart(this.href); return false;” doesn’t stop the request to go to a new page.
Can anyone please give me some pointers – for which I will be very greatful.