Below is my javascript code. It seems to hanging up at the "var data = transport.responseText.evalJSON();" part.
Here is a link to see how my html is made.
http://twisted.visionsminis.com/price/compressors
if (!window.WAUpdater) var WAUpdater = new Object();
WAUpdater.Methods =
{
options: {
redirectOnError: true,
baseUrl: "",
updateColor:'#666666',
mode:"add",
removeRow:null
},
_options: new Object,
setOptions: function(options) {
Object.extend(this.options, options || {});
},
showAjaxModal: function()
{
Modalbox.show('<div id="MB_loading"><br/>Please wait...</div>');
},
updateMiniCart: function(transport, options)
{
this.setOptions(options);
Modalbox.hide();
window.scroll(0,0);
var data = transport.responseText.evalJSON();
//IF THERE'S ANY ERROR
if(data.error)
{
if(this.options.redirectOnError)
{
if(data.url) window.location = data.url;
else history.go(-1);
}
else
{
var error_msg = 'Sorry. There was an error in your operation.';
if(data.error_msg) error_msg = data.error_msg;
Modalbox.show('<div id="MB_message">ERROR:'+error_msg+'</div>',{modal:true});
}
}
else
{
var item_count= data.item_count;
var cart_subtotal = data.cart_subtotal;
var onepage_checkout = data.onepage_checkout;
var link_text = data.link_text;
var cart_subtotal_str = data.cart_subtotal_str;
var cart_subtotal_tax = data.cart_subtotal_tax;
var my_cart_str = data.my_cart_str;
var qty_str = data.qty_str;
var checkout_str = data.checkout_str;
var no_cart_str = data.no_cart_str;
//update item count on top menu
if($$('a.top-link-cart').size()!=0 && link_text)
{
$$('a.top-link-cart')[0].update(link_text);
}
if(this.options.removeRow)
{
if($$('.mini-cart h5').size()!=0 && item_count==0)$$('.mini-cart h5')[0].remove();
new Effect.SlideUp(this.options.removeRow);
}
//update recently added items
if(data.recent_items)
{
if($$('.mini-cart h5').size()!=0) $$('.mini-cart h5')[0].remove();
if($$('.mini-cart .content').size()!=0) $$('.mini-cart .content')[0].remove();
if($$('#cart-sidebar').size()!=0) $$('#cart-sidebar')[0].remove();
// insert recently updated items after checkout button
if ($$('.mini-cart').size() != 0) {
$$('.mini-cart')[0].insert(data.recent_items);
decorateList('cart-sidebar', 'non-recursive');
new Effect.SlideDown('cart-sidebar');
}
}
//total price
if($$('.mini-cart .head').size()!=0)
{
var minicart_itemcount = qty_str;
if(item_count > 0)
{
var minicart_string = '<h4>'+my_cart_str+'</h4>'+minicart_itemcount + '<p class="subtotal">'+cart_subtotal_str+'<strong>'+cart_subtotal+'</strong>'+cart_subtotal_tax +'</p>';
if($$('.mini-cart .actions').size() ==0 && onepage_checkout)
{
$$('.mini-cart .head')[0].insert({
after: '<div class="actions"><button class="form-button" onclick="setLocation('+this.options.baseUrl+'\'/index.php/checkout/onepage/\')" type="button"><span>'+checkout_str+'</span></button></div>'
});
}
}
else
{
if($$('.mini-cart .actions').size() !=0) $$('.mini-cart .actions')[0].remove();
var minicart_string = '<h4>'+my_cart_str+'</h4>';
$$('.mini-cart .head')[0].insert({
after: '<div class="content"><p>'+no_cart_str+'</p></div>'
});
}
$$('.mini-cart .head')[0].update(minicart_string);
new Effect.Highlight($$('.mini-cart .head')[0],{startcolor: this.options.updateColor});
if($$('.mini-cart .head .head').size()!=0) new Effect.Highlight($$('.mini-cart .head .head')[0],{startcolor: this.options.updateColor});
if($$('.mini-cart .actions').size()!=0) new Effect.Highlight($$('.mini-cart .actions')[0],{startcolor: this.options.updateColor});
}
if($$('#shopping-cart-totals-table tfoot').size()!=0)
{
$$('#shopping-cart-totals-table tfoot')[0].update(data.totals_footer);
$$('#shopping-cart-totals-table tbody')[0].update(data.totals_top);
new Effect.Highlight($$('#shopping-cart-totals-table tfoot')[0],{startcolor: this.options.updateColor});
new Effect.Highlight($$('#shopping-cart-totals-table tbody')[0],{startcolor: this.options.updateColor});
}
}
}
};
Object.extend(WAUpdater, WAUpdater.Methods);
function submit_ajax_cart(url)
{
new Ajax.Request(url, {
method: 'get',
onLoad:WAUpdater.showAjaxModal(),
onComplete: function(transport)
{
bu = url.substring(0,url.lastIndexOf("/checkout") ) ;
WAUpdater.updateMiniCart(transport, {baseUrl:bu, mode:"ADD"});
}
});
}
function submit_ajax_cart_p(url)
{
window.opener.submit_ajax_cart(url);
}
/* from this section on is premium */
function delete_ajax_cart(url,row)
{
new Ajax.Request(url, {
method: 'get',
onLoad:WAUpdater.showAjaxModal(),
onComplete: function(transport)
{
bu = url.substring(0,url.lastIndexOf("/checkout") ) ;
WAUpdater.updateMiniCart(transport, {baseUrl:bu, mode:"DELETE", removeRow:row, redirectOnError: false});
}
});
}