add class works before ajax call but not after ajax call?
$.ajax({
type: "POST",
url: "../ajax/basket.php",
data: {planproductId: productIDVal, action: "addToBasket"},
success: function(theResponse) {
if (theResponse.indexOf("<li>" < 0))
{
$("#notication").addClass('error-box');
$("#notification").text(theResponse);
$("#notificationsLoader").empty();
return;
}
}
});
.error-box {
background:#ffecec url('../img/error.png') no-repeat 10px 50%;
border:1px solid #f5aca6;
}
Your if condition is wrong - it should be like this (assuming #notication
being a typo)
if (theResponse.indexOf("<li>") < 0)
This should be...
$("#notification").addClass('error-box');
Not...
$("#notication").addClass('error-box');
And this should be...
if (theResponse.indexOf("<li>") < 0)