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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -