Failure! Set the message with .html()

~desc~


  • SKU:213496
  • Class:
  • BO Class:
  • Cost:
  • Category:
  • Vendor:
  • Reg States:
  • Tags:
  • (Adjust Qty)

    Add Review

    Your email address will not be published

    Comment can not exceed 1000 characters

    Products you might also be interested in
    "); } else { $("#UOMContainer").append("
    "); } } } }); } else { $(".posItemDetail").css('display', 'none'); $("#outerParameterContainer").css('min-width', '100%') //layout override $("#navSection").hide() //layout override } //now that we have a white background - show the colored logo instead of the white one //$("#headerImage").attr('src', '/images/logo@2x.png'); // Setting header log from layout //get the item number from session storage first but then checking if it is in a query string //so the item can be referenced by /ProductDetail?sku=100max from a given link //var itemNmbr = (sessionStorage.itemNmbr != undefined && sessionStorage != "") ? sessionStorage.itemNmbr : (window.location.search.includes('sku') == true) ? location.search.substr(5) : ''; //expects ?sku= as the end of the query string //var itemNmbr = location.search.substr(5); var itemNmbr = ''; ////for testing only //if (itemNmbr == "") // itemNmbr = "200249"; //"200030" GetProductDetail(itemNmbr); GetAlternateItems(itemNmbr); GetLinkedItems(itemNmbr); GetRelatedItems(itemNmbr); GetProductReviews(itemNmbr); CheckForMetalsButtonDisplay(itemNmbr); //if (sessionStorage.QtyByItem != undefined) { if (sessionStorage.EOPMode == "true") { GetQtyAvailableForEOPOrders(itemNmbr); $(".maxQtyAvailableToOrderContainer").show(); } else { $(".maxQtyAvailableToOrderContainer").hide(); } ShowOnlineOrderingLink(); ShowEOPFullfillmentLink(); //set the add2any url to use when sharing $("#addToAnyContainer").attr('data-a2a-url', location.origin + location.pathname + location.search); }) function GetQtyAvailableForEOPOrders(itemNmbr) { //get the existing ShoppingCart array object in sessionstorage qtyByItem = JSON.parse(sessionStorage.getItem("QtyByItem") || "[]"); for (var i = 0; i "; var carouselObjects = []; //Add the main image to the set first let mainImagePath = "../images/product-photos/" + decodeURI(sessionStorage.itemNmbr).replace(">", "````").replace("", "````").replace("", "````").replace("" + "" + "" + "" + ""; } altItemsCarousel += carouselContent; altItemsCarousel += ""; $("#AltItemsSliderContainerBody").append(altItemsCarousel); /** * responsive: { 400: { items: 1 } } center: true, items: 1, loop: false, margin: 10, autoplay: true, autoplayTimeout: 2500, autoplayHoverPause: true, * */ $("#altItemsCarousel").owlCarousel({ autoplay: false, autoplayTimeout: 2500, responsive: { 400: { items: 1 }, 0: { items: 1, nav: false, loop: true }, } }); $("#AltItemsSliderContainerBody").show(); } function switchThumbnailDisplay_PhoneView(elem) { let display = $(elem).attr("display"); let displaySrc = $(elem).attr("display-src"); let iframe = $("#thumnnailproduct-display-phoneview iframe"); let img = $("#thumnnailproduct-display-phoneview img"); let popup = $("#thumnnailproduct-display-phoneview"); let popupBody = popup.find(".modal-body"); var displayFrame = function (hiddenElem, displayedElem) { if (hiddenElem && displayedElem) { hiddenElem.hide(); displayedElem.prop("src", displaySrc); displayedElem.css("display", "block"); popup.modal("show"); } else { OpenNewTab(displaySrc); } }; switch (display) { case "iframe": displayFrame(img, iframe); break; case "img": displayFrame(iframe, img); break; case "othertab": displayFrame(); break; default: displayFrame(); break; } } function setPhoneView_ProductDetails() { $(".btn.btn-outline-dark").css("padding", "3px"); $("hr:not(.hr-footer)").remove(); $(".module").css("padding-bottom", "30px"); } //function DisplayFileChoice(url) { // var d = new Date(); // var n = d.getTime(); // var windowName = "pdfWindow" + n; // //chrome browser issue with window.open requires window be open and then location set in 2 actions or it does not work - you cant just do window.open and pass in url in one shot // var myWindow = window.open("", windowName); //unique window names for multiple windows open at the same time // myWindow.location.href = url; //} function SwapAltImages() { var intAltImagesFound = 0; if ($("#altProductImage1")[0].clientHeight > 0) { //alt image 1 is present if ($("#altProductImage2")[0].clientHeight > 0) { //alt image 2 is present if ($("#altProductImage3")[0].clientHeight > 0) { //alt image 3 is present if ($("#altProductImage4")[0].clientHeight > 0) { //alt image 4 is present intAltImagesFound = 4; } else { //alt image 3 is present but image 4 is not intAltImagesFound = 3; } } else { //alt image 2 is present but image 3 is not intAltImagesFound = 2; } } else { //alt image 1 is present but image 2 is not intAltImagesFound = 1; } } if (intAltImagesFound == 4) { //save off the source of the one being overwritten var srcToSave = $("#productImageMain").prop('src') $("#productImageMain").prop('src', $("#altProductImage1").prop('src')); $("#altProductImage1").prop('src', $("#altProductImage2").prop('src')); $("#altProductImage2").prop('src', $("#altProductImage3").prop('src')); $("#altProductImage3").prop('src', $("#altProductImage4").prop('src')); $("#altProductImage4").prop('src', srcToSave); } else if (intAltImagesFound == 3) { //save off the source of the one being overwritten var srcToSave = $("#productImageMain").prop('src') $("#productImageMain").prop('src', $("#altProductImage1").prop('src')); $("#altProductImage1").prop('src', $("#altProductImage2").prop('src')); $("#altProductImage2").prop('src', $("#altProductImage3").prop('src')); $("#altProductImage3").prop('src', srcToSave); } else if (intAltImagesFound == 2) { //save off the source of the one being overwritten var srcToSave = $("#productImageMain").prop('src') $("#productImageMain").prop('src', $("#altProductImage1").prop('src')); $("#altProductImage1").prop('src', $("#altProductImage2").prop('src')); $("#altProductImage2").prop('src', srcToSave); } else if (intAltImagesFound == 1) { //save off the source of the one being overwritten var srcToSave = $("#productImageMain").prop('src') $("#productImageMain").prop('src', $("#altProductImage1").prop('src')); $("#altProductImage1").prop('src', srcToSave); } } function OpenNewTab(url) { if (url != "") window.open(url); } function GetProductDetail(itemNmbr) { //get all the details //$("#parntershipPricingLabel").hide() $.ajax({ type: "Post", url: "../api/ProductDetail", data: JSON.stringify({ RequestType: "ProductDetail", ItemNmbr: itemNmbr, LocnCode: sessionStorage.OfficeLocnCode, CustomerNumber: sessionStorage.selectedCustomerNumber, PartnershipId: sessionStorage.PartnershipId }), contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { if (response.length == 0 && sessionStorage.EOPMode != 'true') { document.title = "Harrell's | Item Not Found"; document.getElementById("productImageMain").src = "../images/misc/harrellsh.png"; $(".itemNmbr").text("") $(".webName").text("Item Not Found") $(".webDescription").html("") $("#regStates").text(""); $("#webCategory").text(""); $("#webClass").text(""); $("#productDetaiVendor").text(""); $("#shop-description").html(""); } else if (response.length == 0 && sessionStorage.EOPMode == 'true') { //eop item so get the characteristics from the B&H item info itself if (itemNmbr == "") itemNmbr = sessionStorage.itemNmbr; $.ajax({ type: "Post", url: "../api/MyHarrells", data: JSON.stringify({ RequestType: "GetCustomersInvoices", CustomerNumber: sessionStorage.MyHarSelectedCustomer, Mode: "Detail", SOPNumber: '', ItemNumber: itemNmbr }), contentType: "application/json; charset=utf-8", dataType: "json", beforeSend: function (xhr) { $("#spinner").show(); }, success: function (response) { if (response.length > 0) { $(".itemNmbr").text(response[0].ItemNumber.trim()) $(".webName").text(response[0].ProductDesc.trim()) $(".webDescription").html(response[0].ProductDesc.trim()) $("#regStates").text(""); $("#webCategory").text(response[0].Class); $("#webClass").text(response[0].Type); $("#productDetaiVendor").text(response[0].Vendor); $("#shop-description").html(response[0].ProductDesc.trim()); } document.getElementById("productImageMain").src = "../images/misc/harrellsh.png"; }, fail: function () { $("#spinner").hide(); }, complete: function (response) { $("#spinner").hide(); } }) } else { var imagePathPrefix = "../images/product-photos/" + decodeURI(itemNmbr).replace(">", "````").replace("", "````").replace("", "````").replace(" 0 ? "flex" : "none"; $("#altProductLI0").css('display', isVisible); for (var i = 0; i ", "````").replace("
    Available Sizes
    "); for (var i = 0; i " + //"
    " + "
    " + //the below make the item a link to the different sized item - asked to be removed for now //"
    " + response[i].ItemNmbr + "
    " + "
    " + response[i].ItemNmbr + "
    " + "
    " + response[i].SellUofM + "
    " + "
    " + "" ) ////get the photo - or the default if it does not exist //var itemNmbrForPhoto = response[i].ItemNmbr; //$.get("../images/product-photos/" + response[i].ItemNmbr + ".jpg" + "?" + Math.random()) // .done(function () { // //image exists. // document.getElementById("linkedItemImage").src = "../images/product-photos/" + itemNmbrForPhoto + ".jpg" + "?" + Math.random(); // }).fail(function () { // //Image doesn't exist // document.getElementById("linkedItemImage").src = "../images/misc/harrellsh.png"; // }) } } }); }; function GetRelatedItems(itemNmbr) { $("#relatedItemsContainer").show(); $("#RelatedItemsSliderContainerBody").empty(); var doLoop = true; //get the related items in question for this item, create the slides for the carousel $.ajax({ type: "Post", url: "../api/ProductDetail", data: JSON.stringify({ RequestType: "RelatedItems", ItemNmbr: itemNmbr, LocnCode: sessionStorage.OfficeLocnCode }), contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { var itemsToShow = false; var emplContent = ""); //reset the control so new data shows $("#relatedItemsCarousel").owlCarousel({ margin: 10, autoplay: true, autoplayTimeout: 2500, autoplayHoverPause: true, responsive: { 0: { items: 1, nav: false, loop: true }, 600: { items: 2, nav: false, loop: true }, 900: { items: 4, nav: false, loop: doLoop } } }); if (itemsToShow) $("#relatedItemsContainer").css('display', 'flex'); else $("#relatedItemsContainer").css('display', 'none'); } }); } function CheckForMetalsButtonDisplay(itemNmbr){ $.ajax({ type: "Post", url: "../api/ProductDetail", data: JSON.stringify({ RequestType: "CheckForMetalsButtonDisplay", ItemNmbr: itemNmbr}), contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { if (response[0].MetalInOnBase == true) { $("#btnMetals").show() } else { $("#btnMetals").hide() } } }); } function tryToSetImage(imagePathPrefix, elem) { var extension = $(elem).attr("extension"); if (!extension) { nextTrialPath = imagePathPrefix + "." + acceptableExtensions[0] + '?' + Math.random(); $(elem).attr({ "extension": acceptableExtensions[0], "nextextension": 1 });//First index in acceptableExtensions is jpg } else { var currentExtension = acceptableExtensions[Number($(elem).attr("nextextension"))]; if (!currentExtension) { nextTrialPath = $(elem).attr("defaultimage") ? $(elem).attr("defaultimage") : "../images/employee-photos/178.png"; } else { var nextExtension = Number($(elem).attr("nextextension")) + 1; nextTrialPath = imagePathPrefix + "." + currentExtension + '?' + Math.random(); $(elem).attr({ "extension": currentExtension, "nextextension": nextExtension }); } } $(elem).prop("src", nextTrialPath); } function GetProductReviews(itemNmbr) { var totalStarsAllReviews = 0; $("#productsCommentsContainer").empty(); $.ajax({ type: "Post", url: "../api/ProductDetail", data: JSON.stringify({ RequestType: "GetStarRatingsForItemNmbr", ItemNmbr: itemNmbr }), contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { totalRatingCountAllReviews = response.length; $("#reviewsCounter").text("Reviews (" + totalRatingCountAllReviews + ")") for (var i = 0; i " + "
    " + "
    " + "
    " + "

    " + "
    " + response[i].Name + "
    " + "
    " + formatDateTime(response[i].PostDate) + "
    " + "
    " + "

    " + response[i].Comment + "

    " + "
    " ) //highlight the stars that match the star rating given for (var j = 1; j " else starString += "" } $("#totalStarRatingForProduct").html(starString); $("#totalStarRatingForProductDesc").text("(" + totalRatingCountAllReviews + " customer reviews)") } }) } function GoToReviewSection() { //scroll down to reviews section window.location = '#reviewsCounter' //open the tab with the reviews $("#reviewsCounter").trigger('click') } function SaveProductReview() { //validation var continueWithSave = true; var email = $("#productReviewRatingEmail").val(); var name = $("#productReviewRatingName").val(); var comment = $("#productReviewRatingComment").val(); var rating = document.getElementById('productReviewRatingDD').value; if (name == "") { continueWithSave = false $("#errorAlertSubject").text("Failed!"); $("#errorAlertContent").text("Please supply your name to continue"); $("#errorAlert").slideDown() setTimeout(function () { //hide the message after two and a half seconds $("#errorAlert").slideUp() }, 2500) } if (continueWithSave) { if (email == "") { continueWithSave = false; $("#errorAlertSubject").text("Failed!"); $("#errorAlertContent").text("Please supply your email to continue"); $("#errorAlert").slideDown() setTimeout(function () { //hide the message after two and a half seconds $("#errorAlert").slideUp() }, 2500) } if (continueWithSave) { if (rating == 'Your Rating') { continueWithSave = false; $("#errorAlertSubject").text("Failed!"); $("#errorAlertContent").text("Please supply a rating of 1 to 5"); $("#errorAlert").slideDown() setTimeout(function () { //hide the message after two and a half seconds $("#errorAlert").slideUp() }, 2500) } if (continueWithSave) { if (comment == "") { continueWithSave = false; $("#errorAlertSubject").text("Failed!"); $("#errorAlertContent").text("Please supply your comment to continue"); $("#errorAlert").slideDown() setTimeout(function () { //hide the message after two and a half seconds $("#errorAlert").slideUp() }, 2500) } if (continueWithSave) { $.ajax({ type: "Post", url: "../api/ProductDetail", data: JSON.stringify({ RequestType: "SaveProductReview", ItemNmbr: sessionStorage.itemNmbr, Comment: comment, Name: name, CustomerNumber: email, OffsetNumber: rating }), contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { $("#errorAlertSubject").text("Success!"); $("#errorAlertContent").text("Thank you for your feedback"); $("#errorAlert").slideDown() setTimeout(function () { //hide the message after two and a half seconds $("#errorAlert").slideUp() }, 2500) } }) } } } } } function AddItemToCart() { ShoppingCart = JSON.parse(sessionStorage.getItem("ShoppingCart") || "[]"); var inCart = false; for (var i = 0; i Item In Cart! Your item (" + $(".webName")[0].innerText + ") is already in your cart."); $("#genericPopupMessage").slideDown() setTimeout(function () { //hide the message after two and a half seconds $("#genericPopupMessage").slideUp() }, 4000) } else { //get the uom from the uom button that is active uofToUse = "" for (var i = 0; i -1) { uofToUse = $(".uomBtn")[i].innerHTML.toString().trim(); } } if (sessionStorage.EOPMode == "true") { //adjust the qty avail for this item since the depleted some by adding some to the cart QtyByItemArray2 = JSON.parse(sessionStorage.QtyByItem); var QtyByItemArrayNew = []; for (var i = 0; i Success! Your item (" + $(".webName")[0].innerText + ") has been added to your cart."); $("#genericPopupMessage").slideDown() setTimeout(function () { //hide the message after two and a half seconds $("#genericPopupMessage").slideUp() }, 4000) } } function GoToPartnerProducts() { if (sessionStorage.EOPMode == "true") { window.location = location.origin + "/Products/ProductEOP?partner=" + sessionStorage.MyHarSelectedCustomer; } else { if (sessionStorage.PartnerSalesPersonId != undefined && sessionStorage.PartnerSalesPersonId != 0) window.location = location.origin + "/Products/ProductPartner?partner=" + sessionStorage.MyHarSelectedCustomer + "~" + sessionStorage.PartnerSalesPersonId; else window.location = location.origin + "/Products/ProductPartner?partner=" + sessionStorage.MyHarSelectedCustomer; } } function GoToItem(itemToGoTo) { sessionStorage.itemNmbr = itemToGoTo; window.location = location.origin + "/products/productdetail?sku=" + itemToGoTo; } function UOMChange(newItemInfo) { itemNumberOfSelectedUOM = newItemInfo.substr(0, newItemInfo.indexOf("~")); sellCost = newItemInfo.substr(newItemInfo.indexOf("~") + 1) //reset all buttons to not selected $(".uomBtn").removeClass('btn-dark').addClass('btn-outline-dark'); //select the button of the new item $("[id='" + itemNumberOfSelectedUOM + "']").removeClass('btn-outline-dark').addClass('btn-dark') //update session storage with the newly selected item sessionStorage.itemNmbr = itemNumberOfSelectedUOM; //change the description of the labels that matter $(".itemNmbr").text(itemNumberOfSelectedUOM); $(".shop-single-item-price").text(sellCost) //sessionStorage.itemNmbr = itemToGoTo; //window.location = location.origin + "/products/productdetail?sku=" + itemToGoTo; } function SubtractFromQuantity() { if (parseInt($("#cartQuantityOnDetailPage").val()) > 1) $("#cartQuantityOnDetailPage").val(parseInt($("#cartQuantityOnDetailPage").val()) - 1); } function AddToQuantity() { //if ($(".maxQtyAvailableToOrderContainer").css('display') != "none") { if (sessionStorage.EOPMode == "true") { if (parseFloat($("#maxQtyAvailableToOrder").text()) Invalid Quantity! The minimum quanty allowed is 1. Your entry has been adjusted."); $("#genericPopupMessage").slideDown() setTimeout(function () { //hide the message after two and a half seconds $("#genericPopupMessage").slideUp() }, 4000) } else { //if the quantity restriction is in effect and the user keys in a number greater than the allowed max reset the input to the max //if ($(".maxQtyAvailableToOrderContainer").css('display') != "none") { if (sessionStorage.EOPMode == "true") { if (parseFloat($("#cartQuantityOnDetailPage").val()) > parseFloat($("#maxQtyAvailableToOrder").text())) { $("#cartQuantityOnDetailPage").val($("#maxQtyAvailableToOrder").text()) } } } } ) $("#cartQuantityOnDetailPage").on('keypress', function (e) { if (e.which == 43 || e.which == 45) { return false; } }) function ToggleMyHarrellsMenu() { if ($('#expandedMenu').attr('style') == undefined || $('#expandedMenu').attr('style').substr(0, 12) == 'display:none') { $('#expandedMenu').attr('style', 'display:block !important'); $("#productDetailMainWrapper").css('margin-top', $("#navSection").height() - 80) } else { $('#expandedMenu').attr('style', 'display:none'); $("#productDetailMainWrapper").css('margin-top', $("#navSection").height() - 80) } } function DisplayFileChoice(url) { //alert($(window).width()) var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; //alert("is Apple product: " + iOS) if ($(window).width() Products"; var sdsHTML = "SDS"; var labelHTML = "Label"; var employeeHTML = "Employees"; var blogHTML = "Blog Posts"; var pagesHTML = "Pages"; var educationHTML = "Education Pages"; var invoiceHTML = "Invoices"; $.ajax({ type: "Post", url: "/api/Tools", data: JSON.stringify({ RequestType: "GetSiteSearch", SearchTerm: $("#SiteQuickSearchDDInputControl").val().trim().replace("'", "''").replace("`", "''") }), contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { $("#SiteQuickSearchDDULControl").empty(); for (var i = 0; i " + response[i].ItemNmbr + " - " + response[i].WebName + ""; sdsHTML += "
  • " + response[i].ItemNmbr + " - " + response[i].WebName + "
  • "; labelHTML += "
  • " + response[i].ItemNmbr + " - " + response[i].WebName + "
  • "; } else if (response[i].SearchResultType == 'e') { employeeHTML += "
  • " + response[i].Name + "
  • "; } else if (response[i].SearchResultType == 'b') { blogHTML += "
  • " + response[i].Name + "
  • "; } else if (response[i].SearchResultType == 'pg') { pagesHTML += "
  • " + response[i].Description + "
  • "; } else if (response[i].SearchResultType == 'ed') { educationHTML += "
  • " + response[i].Name + "
  • "; } else if (response[i].SearchResultType == 'iv') { invoiceHTML += "
  • " + response[i].SOPNumber + "
  • "; } } }, complete: function (response) { if (productHTML.length > 100) $("#SiteQuickSearchDDULControl").append(productHTML); if (sdsHTML.length > 80) $("#SiteQuickSearchDDULControl").append(sdsHTML); if (labelHTML.length > 80) $("#SiteQuickSearchDDULControl").append(labelHTML); if (employeeHTML.length > 85) $("#SiteQuickSearchDDULControl").append(employeeHTML); if (blogHTML.length > 85) $("#SiteQuickSearchDDULControl").append(blogHTML); if (educationHTML.length > 90) $("#SiteQuickSearchDDULControl").append(educationHTML); if (pagesHTML.length > 80) $("#SiteQuickSearchDDULControl").append(pagesHTML); if (invoiceHTML.length > 85) $("#SiteQuickSearchDDULControl").append(invoiceHTML); } }); } function SiteQuickSearchDDSelected(selectedLI) { //if the item passed in is not the master number use it instead $.ajax({ type: "Post", url: "/api/MyHarrells", data: JSON.stringify({ RequestType: "GetTheMasterItem", ItemNumber: selectedLI.substring(0, selectedLI.indexOf('~')) }), contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { if (response[0].ItemNumber != null && response[0].ItemNumber != "") { //item passed in had a master number so use this //saving the selected customer in session for later use sessionStorage.selectedSiteQuickSearchDDNumber = response[0].ItemNumber; sessionStorage.selectedSiteQuickSearchDDName = response[0].ProductDesc; } else { //item passed in did not have a master so it is its own master sessionStorage.selectedSiteQuickSearchDDNumber = selectedLI.substring(0, selectedLI.indexOf('~')); sessionStorage.selectedSiteQuickSearchDDName = selectedLI.substring(selectedLI.indexOf('~') + 1); } blurToLIDropdownToSelectSiteQuickSearchDD = true; //sessionStorage.selectedSiteQuickSearchDDNumber = selectedLI.substring(0, selectedLI.indexOf('~')); //sessionStorage.selectedSiteQuickSearchDDName = selectedLI.substring(selectedLI.indexOf('~') + 1); $("#SiteQuickSearchDDInputControl").val(decodeURI(sessionStorage.selectedSiteQuickSearchDDNumber) + " - " + decodeURI(sessionStorage.selectedSiteQuickSearchDDName)); $("#SiteQuickSearchDDULControl").hide(); blurToLIDropdownToSelectSiteQuickSearchDD = false; //go to the product page location.href = "/Products/ProductDetail?sku=" + decodeURI(sessionStorage.selectedSiteQuickSearchDDNumber) } }) } function addLayoutFooter() { if (DEVICE.ISPHONE) { $(".footerSubHeader").hide(); $(".footerHeader").css({ "text-align": "center", "color": "white", "font-size": "1.50em", "font-weight": "500" }); $(".footerHeader a").css("color", "white"); $(".footerHeader").show(); } $("#footerContainer").show(); }