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

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -