Hi guys,

I'm working on a shopping cart and I'm having some difficulties with a concept.

Basicly, I remove two articles in a certain condition and it works perfectly.
My problem is that I want to redirect the user instantly if these two articles are removed from the cart.
When I enter the window.location, it is refreshing the page but it's not updating the cart from the ajax call.

So what I want to achieve is that after these two ajax calls, i want to be redirected but also, the ajax call should do their things in the delete_item.php :)

I'm using jQuery inside a normal javascript file on a certain function.

    function deleted(id, pozitie) {
        var msg = 0;
        $(document).ready(function(){                    
            $('.' + id).each(function() { 
                $(this).remove();
                $('.sm').remove();
                ajaxpage("delete_item.php?id="+pozitie+"&ord="+ordrno,"error");
                ajaxpage("delete_item.php?id="+(pozitie+1)+"&ord="+ordrno,"error");
                window.location="http://mypage.com/offer";
                msg = 1;
            });
        });
Member Avatar
LastMitch

I'm working on a shopping cart and I'm having some difficulties with a concept.

Are you using a e-comm platform or you wrote this e-comm website?

My problem is that I want to redirect the user instantly if these two articles are removed from the cart.

You mean click back to shop and then view cart and the item is in the cart?

When I enter the window.location, it is refreshing the page but it's not updating the cart from the ajax call.

That is correct it shouldn't. If it did, you will have more major issues with the shopping cart and the items calculation of prices and update quantity.

Thank you, I've managed to solve the problem with a callback function in my ajaxpage();

It is a custom made platform.