php - JavaScript variable doesn't work in Laravel -


All the pages of my website have the same title. I have implemented this:

  extended ('layouts.man')  

Now in some pages, send me a successful message and not a page in the other I implemented it like this:

  back ....- & gt; (Array (sucessfulMessage = & gt; 'asdf'));  

Please note that I am not only in some pages.

Now I want to use that variable in javascript. I did it in layout. Main:

  & lt; Head & gt; {{HTML :: Script ('/ JS / Jquery-2.1.1.JS')}} @ if (continued (successful message)) < Script & gt; Var successful message = "{{$ successful message}}"; & Lt; / Script & gt; @endif {{HTML :: script ('/ js / myPopupScript.js')}} & lt; / Head & gt;  

and then myPopupScript.js I did this:

  $ (document) .ready (function () {if (! Type of successful message === 'undefined') {warning (successful message);} and {warning ("test");}});  

My problem

Warning always test even if a successful message has been sent.

Important note

When I use F12 in Google Chrome to view the actual HTML, I can see it:

 < Code> & lt; Script & gt; Var Successful Message = "asdf"; & Lt; / Script & gt;  

Then the variable is defined.

code that works {} (type (successfully message) = {'string'} {warning (Successful message);} Other warning ("undefined");}});

Many thanks for @martinezjc, @lowerends and @ththhu


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -