Jump to content

Why will this get old data?


pwntastic

Recommended Posts

Hello, 

I have a function which gets data from a div1 and is suppose to display it in another div2.  This function is executed when the page is loaded, and again on mouseover of a third div. So when first loaded, it has 1 value.  Then this value is updated through a form without refreshing the page.  When I do the onmouseover on div3, it still displays the 1 value even though it should be 2 values now.  If I view source, it displays 2 values in that third div.  If I refresh the page, it then shows 2 values.  It does this if I keep increasing values even though the source code has the correct number of values.  Why does it do this and how could I fix this issue?  I've posted the function here...the function is suppose to place the data into a fourth div.  

function get_data(){                    
                    product_data = $("#get_data").find(".ProductList").html();                                                             
                    product_data = '<ul id="product_list" style="list-style: none; margin: 0 auto; padding: 0; width: 300px; height: auto; display: block; vertical-align: middle; position: relative; top: 10px;">' + product_data+ '</ul><div id="button_wrapper" style="margin: 30px auto; width: 350px; height: 70px;"><a style="color: #fff; display: block; background-color: #5a5353; width: 120px; height: 50px; margin: 10px; float: left; text-align: center; line-height: 45px; border: 1px dashed #fff; outline: 2px solid #5a5353;" class="link_button" href="http://www.vapenvapor.com/cart.php">View Full Cart</a><a href="https://store-fiaz3cj8.mybigcommerce.com/checkout.php" class="link_button" style="color: #fff; display: block; background-color: #5a5353; width: 120px; height: 50px; margin: 10px; text-align: center; line-height: 45px; border: 1px dashed #fff; outline: 2px solid #5a5353; float: right;">Checkout</a></div>';                    
                    $("#cart_preview").html(product_data);
                                        
                    $("#cart_preview>#product_list>li").css({"margin" : "10px 0 10px 0", "border-bottom" : "1px dashed #fff ","padding": "5px"});                     
                    $("#cart_preview>#button_wrapper>.link_button").css({"color": "#fff", "display": "block", "background-color": "#5a5353", "width": "120px", "height": "50px", "margin": "10px", "float": "left", "text-align": "center", "line-height": "45px", "border": "1px dashed #fff", "outline": "2px solid #5a5353"});
                }
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.