Load A The Page Itself When 410 Error Is Send Intentionally For SEO Purposes
I have got a website with lots of products which can be bought by clients.
I have implemented an
adding to cart button which adds the product to a Session variable after clicking on it. A part from this, there is a cart icon on the header of the page which has a number that increases depending on the quantity of products that there are on the cart with a jquery function:
$("#topcart").load(location.href+" #topcarrito");. It loads only the div that contains the length of the array which contains the products cart session variable.
All this stuff has always worked perfectly since my SEO coworker wanted me to apply a 410 error-code to some products for SEO purposes, just to have less products indexed as they were redundant (non-rich descriptions and so). The way I did it was by adding
header('HTTP/1.1 410 Gone'); to them.
The problem is that at this time, when I try to add a product that has a 410 error set up to the cart, as the web browser detects the error, it does not load the div with the updated quantity of products in the cart. Instead, the console shows up the 410 erorr. However, if I reload the page by ckicking
F5 the number of products in the cart loads correctly, so the product got added to the cart.
Is there any way I can do to load that div even when the browser detects the 410 error?
Just in case someone has this problem as well, I've finally found a way to solve it.
What I did is to create a new php file which gets the count of the session array and echo it, get it through an AJAX call and then modify the div with a simple
$("#topcarrito").text(value) so there is no need to load the page that gives the 410 error.
- → OctoberCMS - How to make collapsible list default to active only on non-mobile
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → when i send data with ajax(jquery) i don't find the values in controller without form in laravel 5.1
- → DropzoneJS & Laravel - Output form validation errors
- → Knockout JS - How to return empty strings for observable fields
- → How to replace *( in a string
- → Get the calling element with vue.js
- → Sent Variable to Controller via Ajax in Blade
- → AJAX folder path issue
- → KNockout JS - Automatic reload of ajax call