0

I have a question regarding simpleCart(js). I'm new to javascript and I know there is a lot of information on simplecartjs.org, but I couldn't find the answer I was looking for.

I am trying to implement simplecart into my website; which is completely written in HTML5/CSS3.

I have an index.html which has <script src="simpleCart.js"></script> & <script src="jquery.min.js"></script> in the head for loading the simpleCart(js) script and the jquery library, and I have <span class="simpleCart_quantity"></span> & <div class="simpleCart_items"></div> & <div class="simpleCart_total"></div> in the body for loading the quantity of items, the cart items and the total costs of items in the cart. Also in the body is an iframe which loads products.html into the frame.

In products.html I have exactly the same head but the body contains the products (shelfitems), which have all the right classes.

When I load my website and click on add to cart it doesn't do anything.. or wait it does! but only after a browser refresh. This is very frustrating, because when I add a vew products and then click refresh they show up, but when I delete some products and higher or lower the quantity in the cart by (+/-) AND then add some other products WITHOUT refreshing in between, it will not register the deleted products and the changes in quantity.

I have been looking all over the internet for answers, have tried alot of suggestions of other people, but I can't find the solution to this problem. I know; without the iframe it would work fine, I have tested that. But for my website I need the iframes, because I have many pages which all load into the iframe. I hope this information is good enough the make the problem clear. I would appreciate it very much if I could get some help here!

1 Answers1

0

I guess,You can make an object of iframe and then add content or delete content from it for window we can make an object and be able to access contents but for iframe I am not sure but mostly you can

var doc=document.getElementById("frame").contentWindow.document;
neelsg
  • 4,802
  • 5
  • 34
  • 58
Sid
  • 801
  • 8
  • 19
  • I was not sure where to add this code (I'm new to js haha) so I tried it in the index.html head/body and in the products.html head/body, in every possible way, but no results. – user3421073 Mar 31 '14 at 13:41
  • Write code in your click event in side that find your iFrame as object (as "var doc") and in $(doc).html() you get every element of iframe do what ever you want in your iframe........... – Sid Mar 31 '14 at 13:50
  • Thank you for the help! I tried adding those, but too bad, it doesn't work, maybe it has something to do with the simpleCart.js but I really don't know – user3421073 Mar 31 '14 at 19:08