I am trying to access the ProductController from AJAX Call
I have added the following method to the ProductController class
public ActionResult test()
{
return null;
}
And I am trying to access it from the _ProductBox.cshtml like so
function onQuickViewClick(id, name){
//show loading image
try{
//fetch and populate data
document.getElementById("modal1Title").innerHTML = name;
$.ajax({
url: "productcontroller/test",
data: {},
type: "POST",
contentType: "application/json; charset=utf-8",
processData: false,
dataType: "json",
success: success,
error: fail
});
}
catch (e) {
alert(e.message);
}
}
function success(results) {
alert("accessed");
}
function fail(err) {
alert(err.status + " " + err.statusText);
}
Please help me with this somebody. What I am trying to achieve is pull the product details via AJAX call and display that in a popup modal
You help would be greatly appreciated!