Monday 15 February 2010

jquery - PHP Javascript Uncaught SyntaxError: Unexpected token ILLEGAL -


I have this PHP script and it does not work properly. What's wrong

  & lt ;? Php if (isset ($ success) || isset ($ failure)) {? & Gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ('div.aler'). CSS ('display', 'block'); $ ("div.aler"). Html ("& lt ;? php if ( $ Success) {echo '& lt; p class = \ "success \" & gt;'. $ Success. '& Lt; / p & gt;'; elseif ($ failure) {echo '& lt; p class = \ "Failure \" & gt; Feedout ("slow", function () {$ ("" $$ "Div.aler"). Remove ();});}, 5000);}); & lt; / Scripts>   

I think there should be a problem with quotation marks ". The message is $ failure , but Javascript does not put it in HTML div div.aler . I get this error message in the Chrome console:

Unkit syntax error: unexpected token invalid

You forgot isset in the row below, due to its requirement" || " (Or) If your first statement, then throwing a php and breaking your javascript

  $ ("div.aler"). Html ("& lt ;? Php if ($ success)" {ao & lt; p class = \ "success \" & gt; $ success. '& Lt; / p & gt;';} elseif ($ Failure) {echo '' 

To change it ...

  $ ("div .lL ("    

No comments:

Post a Comment