Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tominated

macrumors 68000
Original poster
Jul 7, 2006
1,723
0
Queensland, Australia
I have just uploaded my proof of concept (non-working) shopping cart to check loading times, but the javascript (well, jquery javascript. i have gotten quite fond of it) doesn't work. Also, when I was viewing it in safari (locally through MAMP) the javascript didn't work either. can anybody help?

BTW: linky - http://tominatedsoftware.com/shop
 
Seems to works fine.

You have checked the obvious?
 

Attachments

  • Picture 38.png
    Picture 38.png
    66.9 KB · Views: 125
I'd guess that it can't find the local copy of the JQuery code files. Make sure the src attribute is set appropriately.
 
For whatever reason, you have to click clear once, then start adding items and it then it works.

I think this is definitely a problem with your javascript than the browser.


I'd guess that it can't find the local copy of the JQuery code files. Make sure the src attribute is set appropriately.

A quick glance at the page reveals this part is fine.
 
What is not working exactly.

I can add things to the cart and clear the whole cart.

I can't clear individual items though.

that is what I have implemented (i have to add the single item remove function).

i don't have a clue why you have to clear first. can a JS expert check out my script to see if it is ok?
 
that is what I have implemented (i have to add the single item remove function).

i don't have a clue why you have to clear first. can a JS expert check out my script to see if it is ok?

Disclaimer: I have only dabbled in the language and am no expert.

Change

Code:
if (applejuice == ''){
	var applejuice = '0'
	var deepsea = '0'
	var x = '0'
}

to

Code:
if (applejuice == null){
	var applejuice = '0'
	var deepsea = '0'
	var x = '0'
}

but I would do:

Code:
if (applejuice == null){
	var applejuice = '0'
}

if (deepsea == null){
	var deepsea = '0'
}

if (x == null){
	var x = '0'
}

Because otherwise aren't you assuming that if they haven't brought Apple Juice they haven't brought anything else?

If there is no apple juice cookie the the apple juice variable is set to null, and not an empty string.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.