jQuery Function not Working onClick
I have a jQuery function which is fired when a user clicks on an image to add a item to a basket. Currently the PHP code behind the event runs fine and executes correctly. The issue is that I think the Javascript is not actually running and as there is no error messages being displayed I'm stuck and unsure how to debug. Any Advice?
ecomm_functions.js
-
//Functions to Add To Basket
$(".productPriceWrapRight a img").click(function() {
//jAlert('This is a custom alert box', 'Alert Dialog');
var partNoValSplitter = (this.id).split("_");
var partNoVal = partNoValSplitter[1];
$("#notificationsLoader").html('<img src="/clearance/images/loader.gif" />');
$.ajax({
type: "POST",
url: "/clearance/includes/ecomm_functions.php",
data: { partNo: partNoVal, action: "addToBasket"},
success: function(theResponse) {
if( $("#partNo_" + partNoVal).length > 0){
$("#partNo_" + partNoVal).animate({ opacity: 0 }, 500, function() {
$("#partNo_" + partNoVal).before(theResponse).remove();
});
$("#partNo_" + partNoVal).animate({ opacity: 0 }, 500);
$("#partNo_" + partNoVal).animate({ opacity: 1 }, 500);
$("#notificationsLoader").empty();
} else {
$("#basketItemsWrap li:first").before(theResponse);
$("#basketItemsWrap li:first").hide();
$("#basketItemsWrap li:first").show("slow");
$("#notificationsLoader").empty();
}
}
});
});
HTML
-
<?php
/*ini_set('display_errors', 1);
error_reporting(E_ALL);*/
if ($lang == "")
{
$lang = "en";
}
include '../includes/phpheader.php';
include "includes/ecomm_functions.php";
include "../includes/connect.php";
include "../includes/func.php";
include "../includes/func_wv3.php";
$page = "clearance";
$breadcrumbs = '<a href="/?lang='.$lang.'">'.getPhrase("Home", $lang).'</a> > <a href="/media.php?lang='.$lang.'">'.getPhrase("Media", $lang).'</a> > <a href="/videos.php?lang='.$lang.'">'.getPhrase("Videos", $lang).'</a>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>HPI Racing Europe - Clearance
</title>
<? include "../includes/common_header.php"; ?>
<link href="/_css/1024.css" rel="stylesheet" type="text/css" />
<link href="hpitv.css" rel="stylesheet" type="text/css" />
<link href="/_css/clearance.css" rel="stylesheet" type="text/css" />
<link href="/clearance/scripts/jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
<script src="/_scripts/jfuncs.js" language="javascript"></script>
<script type="text/javascript" src="_js/main.js"></script>
<script type="text/javascript" src="_js/dynamicproductlisting.js"></script>
<script type="text/javascript" src="_js/browserinfo.js"></script>
<script type="text/javascript" src="_js/anylink.js"></script>
<script type="text/javascript" src="_js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="_js/ecomm_functions.js"></script>
<script src="/clearance/scripts/jquery.alerts.js" type="text/javascript"></script>
</head>
<body onLoad=" changeClass('DC', 'menuExpanded') , changeClass('ED', 'menuExpanded') , changeClass('HB', 'menuExpanded') , changeClass('HP', 'menuExpanded') , changeClass('MB', 'menuExpanded') , changeClass('ML', 'menuExpanded') , changeClass('MV', 'menuExpanded') , changeClass('OP', 'menuExpanded') , MM_preloadImages('graphics/common/brand_logos/DC_on.jpg'), MM_preloadImages('graphics/common/brand_logos/ED_on.jpg'), MM_preloadImages('graphics/common/brand_logos/HB_on.jpg'), MM_preloadImages('graphics/common/brand_logos/HP_on.jpg'), MM_preloadImages('graphics/common/brand_logos/MB_on.jpg'), MM_preloadImages('graphics/common/brand_logos/ML_on.jpg'), MM_preloadImages('graphics/common/brand_logos/MV_on.jpg'), MM_preloadImages('graphics/common/brand_logos/OP_on.jpg') ">
<? include "../includes/header_1024_tv.php"; ?>
<div id="oMainContainer">
<div id="oContainer">
<div id="oLeftNavigation">
<? //include "includes/left_browser.php"; ?>
</div>
<div id="oMiddleContent">
<div id="oLargeClearanceHeader"> <div style="height: 100px; margin-bottom: 10px; background-repeat: repeat-x; background-image: url(http://www.hpiracing.co.uk/graphics/clearance_corner/bg.gif); background-position: left top;"><img src="http://www.hpiracing.co.uk/graphics/clearance_corner/main_banner.jpg" /></div></div>
<div id="oIntroductionText">
<p>Welcome to the HPI Clearance Corner! This is where you can find one-off special deals direct from the UK importer for the top brands in RC. These are end-of-line products that have been discontinued by the manufacturer and are no longer generally available. Get them direct from HPI and shipped straight to you at a one-time low price, because when they're gone, they are GONE!</p>
<p>These are all brand new items still in their original packaging, no scratch-and-dent specials here! Find yourself a bargain and stock up on the parts you've been searching for!</p>
</div>
<div id="oOptimiseSearch">
</div>
<div id="oResults">
<div class="productWrap">
<div class="productImageWrap"><img src="#" /></div>
<div class="productNameWrap">Test Product</div>
<div class="productPriceWrap">
<div class="productPriceWrapLeft">£ 95.00</div>
<div class="productPriceWrapRight">
<a href="/clearance/includes/ecomm_functions.php?action=addToBasket&partNo=101035" onClick="return false;"><img src="http://www.hpiracing.co.uk/graphics/n51/buyit2301.gif" alt="Add to Basket" id="partNo_101035" /></a>
</div>
</div>
</div>
</div>
</div>
<div id="oRightNavigation">
<? include "includes/right_basket.php"; ?>
</div>
</div>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-757566-1";
urchinTracker();
</script>
</body>
</html>