简体   繁体   中英

Click event URL to open another page in asp.net MVC using javascript/Jquery

Is it possible to click on the event on the Calendar (I'm using a fullcalendar plugin) and get redirected or open a Details view page in asp.net MVC related to this eventID using javascript/Jquery, so that the code will give the same URL to all events? Fullcalendar is integrated into asp.net mvc.

I wrote this code, but it didn't work:

eventClick: function(calEvent, jsEvent, view) {
    window.location = "<%= Url.Action("Details", "ReservationRequests", new { id = 
 Model.ID})

Thank you for your help!

Your code for redirecting missing the closing ";

Try

$(document).ready(function() {
    $('#calendar').fullCalendar({
        eventClick: function() {
            window.location = "<%= Url.Action("Details", "ReservationRequests", new { id = Model.ID})%>";
        }
    });
});

Where calendar is the id of the div.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM