I'm trying to create a jquery/ajax script. The purpose is to take data from a database, compare results in the successFunc and do the next ajax call to a mvc actionResult which would render a view according to the result. For some reason it is not working.
function GetPageData() {
$.ajax({
type: "Post",
url: '/Track/GetPageData',
dataType: "json",
data: param = "",
success: successFunc,
error: errorFunc
});
function successFunc(data, status) {
alert('data; '+data+', '+'status: '+status);
if (data == 'contact') {
$.ajax({
type: "Post",
url: '/Track/Contact',
dataType: 'json',
success: successF,
error: errorF
});
function successF() {
alert('services')
}
function errorF() {
alert('servicesFail')
}
}
One of ActionResults methods:
public ActionResult Contact()
{
return View();
}
During debugging I can see that call is made to ActionResult Contact() but it does not render the view. Any idea why the code is not working?