jquery - unable to stop ajax call on document ready -
i have ajax function optionally run mvc view loaded, can't stop running. i've set boolean variable stop function, value ignored. when understand why, i'll try , pass value view model set true/false - govern whether or not call ajax function when view loads. following snippet makes ajax call though seems shouldn't.
$(document).ready(function () { $("#divloading").show(); var doit = false; if (doit) { callajaxpost(); } }); function callajaxpost() { var url = '@url.action("postmethod", "nav")'; $.post(url, null, function (data) { $("#pid")[0].innerhtml = data; $("#divloading").hide(); }); }
there error in code. works expected.
Comments
Post a Comment