Skip to content

Instantly share code, notes, and snippets.

@joshi-kumar
Created February 17, 2018 13:35
Show Gist options
  • Save joshi-kumar/d56d15e3e832fa52291e841eb701857c to your computer and use it in GitHub Desktop.
Save joshi-kumar/d56d15e3e832fa52291e841eb701857c to your computer and use it in GitHub Desktop.
Script
analyticsandreport: function (urladd,productId,categoryId,typeId) {
$.ajax({
cache: false,
url: '/AnalyticsAndReports/InsertAnalytic',
data: { productId: productId, typeId: typeId, categoryId: categoryId },
type: 'post',
success: function (data) {
// window.location.href = urladd
},
});
},
-----------------------------------------
<div class="image"> <a onclick="AjaxCart.analyticsandreport('@analyticsurl','@productId','@categoryId','@typeId');return true;" href="@Url.RouteUrl("Product", new { SeName = Model.SeName })"><img alt="@Model.DefaultPictureModel.AlternateText " src="@Model.DefaultPictureModel.ImageUrl " title="@Model.DefaultPictureModel.Title " /></a> </div>
Here if we do return true the call anchor else not come back and anchor url will not call;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment