I am making a webpage in which I have a anchor tag '' having a URL in href but the problem is that on clicking on this anchor tag it will check the condition through ajax and by the response from the ajax it will decide whether to send to another page or not.
I have tried this so far the ajax is working good but when I click on the anchor tag the new page is open in new window and ajax run on the same and it doesn't matter whether the response is true or false
<a href="www.recordlist.com" class = "checkrecord" check_us_type = "user" target = "_blank"> check</a>
<script>
$(".checkrecord").click(function(e){
e.preventDefault();
var user_type = $(this).attr("check_us_type");
$.ajax({
type: "POST",
data: { 'ven_type' : ven_type },
url: baseUrl+"/CheckUser",
success: function(result){
if(result == "-1")
{
alert("Please login to view Details");
}else
{return true;// here it should work but it doesn't
}
},
});
});
</script>