working ajax call code is given below
$('#callControllerBtn').click(function () {
currentlySelectedRow = grid.select();
sendProductIDToController(currentlySelectedRow);
});
function sendProductIDToController(currentlySelectedRow) {
$.ajax({
url: "Home/sendProductID/", // Home = Controller , sendProductID = Action
data: {
ID: pID
},
cache: false,
type: "POST",
timeout: 10000,
dataType: "json",
success: function (result) {
if (result) {
alert("Successfully Completed");
grid.removeRow(currentlySelectedRow);
editor.value("");
} else {
alert("Failed");
}
}
});
}
Now i want to write the same code but using JS test method.I am using QUnit, ChutzPah in vs 2010, just let me what is the good practice to mock/Fake ajax call also implement working code with test method.