javascript - jQuery button to send parameters not direct to correct URL -
i have following button call method , send parameters method
<input type="button" id="report" data-baseurl="@url.action("reportexport", "home")" value="generate report" class="btn btn-success submit" />
this script
$('#report').click(function () { // build url var reporturl = $(this).data('baseurl') + '?id=' + "pdf" + '&type=' + $('#type').val() + '&category=' + $('#category').val() + '&country=' + $('#country').val() + '&subsidary=' + $('#subsidary').val() + '&datehere=' + $('#date').val(); // redirect location.href = reporturl; });
this controller class
public actionresult reportexport(string id, string type, string category, string country, string subsidary, string datehere) { ............. }
but once click button directing url following
http://localhost:49669/home/undefined?id=pdf&type=002&category=&country=&subsidary=&datehere=
its taking undefined controller method instead of taking correct method,
whats wrong approach
Comments
Post a Comment