Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Ajax go to next page

$
0
0

Hi,

By clicking on a box get an ID. Also when I click on the box I should go to another page... But I keep getting an error...

My code:

JS/AJAX

function toChart(chartID) {
    var ID = chartID;
    console.log(ID);$.ajax({
        type: "POST",
        url: '/ChartExpanded/Home',
        contentType: "application/json; charset=utf-8",
        data: { iChartID: ID },
        dataType: "json",
        success: function () {
            window.location.href = '/Home/ChartExpanded?';
         }
    });
    //var jsonAsText = JSON.stringify([0]);
    //window.location.href = '/Home/ChartExpanded?jsonAsText=' + jsonAsText;

}

Controller:

public IActionResult ChartExpanded(int iChartID)
        {
            //Code to store the int
            return View();
        }


Chartexpanded cshtml:

@{
    ViewData["Title"] = "test"; //code to display the int instead of test
}


The error:
POST http://localhost:65053/ChartExpanded/Home 404 (Not Found)

The result I want:
To go to the next page and display the number

Kind regards.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>