asp.net mvc - How to setup Multi-page app with RequireJS with inline Javascript -


i'm trying convert project use requirejs instead of solution have below. have layout page contains of scripts @ bottom of page (except modernizr) before tag this:

<head>     <script src="@links.assets.scripts.libraries.modernizr_2_6_2_js"></script> </head>  <body>     <!-- page content goes here -->      @rendersection("prescripts", false)     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>     <script>window.jquery || document.write('<script src="@links.assets.scripts.libraries.jquery_1_9_1_min_js"><\/script>')</script>     <script src="@links.assets.scripts.libraries.jquery_namespace_js"></script>     <script src="@links.assets.scripts.libraries.jquery_unobtrusive_ajax_js"></script>     <script src="@links.assets.scripts.libraries.jquery_validate_js"></script>     <script src="@links.assets.scripts.libraries.jquery_validate_unobtrusive_js"></script>     <script src="@links.assets.scripts.libraries.jquery_timeago_js"></script>     <script src="@links.assets.scripts.libraries.toastr_js"></script>     <script src="@links.assets.scripts.views.shared._master_js"></script>     @rendersection("postscripts", false)      @{         var errormessage = tempdata[tempdataconstants.errormessage] string;         var infomessage = tempdata[tempdataconstants.infomessage] string;         var successmessage = tempdata[tempdataconstants.successmessage] string;         if (!string.isnullorempty(errormessage)) {             <script>                 var origtimeout = toastr.options.timeout;                 toastr.options.timeout = 0;                 toastr.error(@html.raw(json.encode(errormessage)));                 toastr.options.timeout = origtimeout;             </script>         }         if (!string.isnullorempty(successmessage)) {             <script>                 var origtimeout = toastr.options.timeout;                 toastr.options.timeout = 0;                 toastr.success(@html.raw(json.encode(successmessage)));                 toastr.options.timeout = origtimeout;             </script>         }         if (!string.isnullorempty(infomessage)) {             <script>                 var origtimeout = toastr.options.timeout;                 toastr.options.timeout = 0;                 toastr.info(@html.raw(json.encode(infomessage)));                 toastr.options.timeout = origtimeout;             </script>         }     } </body> 

in individual pages use layout page populate postscripts section:

@section postscripts {     // javascript belongs single page goes here. } 

problems

i've followed this example can see i'm checking tempdata on server see if not null popup toastr message on client. i"m not sure best way go doing , have tried many things. ideas?


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -