asp.net - jQuery script not recognised when injected in my view (.cshtml) -
asp.net - jQuery script not recognised when injected in my view (.cshtml) -
usually create javascript file (myfile.js) scripts.
example:
/// <reference path="../../scripts/jquery/jquery-1.5.1.js" /> $(document).ready(function () { // bind 'myform' , provide simple callback function $('#uploadbackgroundform').ajaxform({ iframe: true, datatype: "json", success: backgrounduploadedsuccess, error: backgrounduploadederror }); });
now place script straight in view (.cshtml) in section (< script type="text/javascript">.....< / script >).
example:
...my view goes here... <script type="text/javascript"> /// <reference path="../../scripts/jquery-1.5.1.js" /> $(document).ready(function () { // bind 'myform' , provide simple callback function $('#uploadbackgroundform').ajaxform({ iframe: true, datatype: "json", success: backgrounduploadedsuccess, error: backgrounduploadederror }); }); .... </script>
but doesn't work. mean when place cursor on jquery syntax 'ready' , click ctrl+j nil recognised.
any idea?
thanks.
you have add together reference such build :
@if (false) { <script src="~/scripts/jquery-1.5.1.js" type="text/javascript"></script> }
with @if (false)
script not loaded @ runtime... (you can see page).
update : have insert code before other script tag.
jquery asp.net asp.net-mvc
Comments
Post a Comment