javascript - mvc partial view js file not working debug -


hello if use inside js file view javascript debug not working

person.js

function loadpersons() {      $.ajax({         url: '/person/getpersons/',         type: 'post',         datatype: 'json',         contenttype: 'application/json; charset=utf-8',          async: false,         success: function (result) {          },         error: function (jqxhr, textstatus, errorthrown) {             dynamicalertifyfunction('error', 'getcrew');         }     });  } person.cshtml      <script src="~/scripts/person.js"></script>      <script>         $(document).ready(function () {             loadpersons();          });     </script 

but if use inside js file _layout debug working why ?

person.cshtml  @*  <script src="~/scripts/person.js"></script>*@  _layout.cshtml      <script src="~/scripts/person.js"></script> 

thank you

just check, referencing jquery file before or after call person.js? if you're implementing partial view, , calling jquery @ bottom of _layout page, won't instantiate $.ajax in person.cshtml.

also, again, not sure if you're doing or not, bear in mind sections not work in partial views, make sure aren't including script tag within @section scripts {} in person.cshtml.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -