Ignore http errors on $.ajax()
Hi,
Even if my title is a little outrageous, more silly is the reason because I ask. I'm parsing a site for an chrome extension, but for some reason or other the server returns error 500 rendering "success" unusable. In the browser it shows alright, without problems (seems like it use the page I'm trying to parse as error page, or idk). Here is my code:
- getListChaps : function (urlManga, mangaName, obj, callback) {
- $.ajax({
- url : urlManga,
- beforeSend : function (xhr) {
- xhr.setRequestHeader("Cache-Control", "no-cache");
- xhr.setRequestHeader("Pragma", "no-cache");
- },
- success : function (objResponse) {
- var div = document.createElement("div"),
- res = [];
- div.innerHTML = objResponse;
- $(".divthickborder:last .blacklabel14 a", div).each(function () {
- if ($(this).text().trim() !== "") {
- var name = $(this)[0].innerText.replace(mangaName, '').trim();
- name = name.replace(' :', ':');
- res[res.length] = [name, $(this)[0].href];
- }
- });
- res.reverse();
- callback(res, obj);
- }
- });
- },