4

I try to make a basic progress bar with ajax , when I click button add to cart, but I don't know how catch the xhr on console,to put on alert() or prepend()function

I follow a video example in youtube, with XMLHttpRequest() function but I see doesn't work

see the code:

var xhr = new XMLHttpRequest();

xhr.upload.addEventListener('progress', ProgressHandler ,false);
xhr.addEventListener('load', CompleteHandler,false);
xhr.addEventListener('error', errorHandler,false);
xhr.addEventListener('abort',LoadHandler,false);


xhr.open("POST","/test/checkout/cart/add/uenc/aHR0cDovLzQ1Ljc5LjE0Ni4yMS90ZXN0L3Rlc3RpbmcuaHRtbA%2C%2C/product/1/");
xhr.send();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.