c# - Odd Behavior with Ajax call to MVC Controller Method -
i experiencing odd behavior mvc, ajax , saved credentials. although have work around, wondering if me understand issue might be.
i using datatables jquery plug-in display results of call controller's action method. here sample of call:
$('#grdtournamentlist').on('init.dt', function () { $("input[name='tournamentselect']").on("change", function () { $('#btnmovenextstep1').removeattr("disabled"); }); }).datatable({ "ajax": { "type": "post", "contenttype": "application/json; charset=utf-8", "url": "quickstart/toptenmostrelevanttournaments", "data": {}, "datatype": "json", "datasrc": "" } }); });
if use code during user's first login (allowing credentials saved locally), toptenmostrelevanttournaments method call made , grid populated.
request: /xxxx/xxxxx/quickstart/toptenmostrelevanttournaments
if user closes browser , attempts go in, saved credentials bypass login , take user view containing grid. @ point call controller fails. while debugging it, see generated url ajax call incorrect. controller appears twice:
request: /xxxx/xxxxx/quickstart/quickstart/toptenmostrelevanttournaments
if change ajax call use razor @url.action method when setting url. call works without issue.
"url": "@url.action("toptenmostrelevanttournaments", "quickstart")",
my question why happening? why saving user's credentials cause odd behavior? please note rest of application works fine.
thanks in advance!
look @ comments answer
Comments
Post a Comment