In js file
if (condition) {
$.ajax({
cache: false,
type: 'GET',
url: '/demo/partialview1',
data: null,
success: OnSuccessCall,
error: OnErrorCall
});
}
else {
$.ajax({
cache: false,
type: 'GET',
url: '/demo/partialview2',
data: null,
success: OnSuccessCall,
error: OnErrorCall
});
}
})
var OnSuccessCall = function (response) {
$('#divname').html(response.valueOf(0))
}
var OnErrorCall = function () {
alert(request.status + " " + request.statusText);
}
In controller
public ActionResult partialview1()
{
return PartialView();
}
public ActionResult partialview2()
{
return PartialView();
}