$j('.real_time_availability_listing').click(function(e){ var the_element = $j(this); //remove error message if it's there the_element.siblings('p.error').remove(); // replace with spinners var availabilityRow = the_element.closest('tr').find('p.availability'); availabilityRow.html('').attr('data-sku'); var skus = ''; availabilityRow.each(function() { skus += 'skus[]=' + $j(this).attr('data-sku') + '&'; }); $j.ajax({ type: 'GET', url: BASE_URL + 'catalog/product/availability', data: skus, dataType: 'json', success: function(data){ if (data.error) { the_element.after('

' + data.message + '