javascript - What's wrong with this php syntax? -


i getting error in browsers console while executing code :-

    <script type="text/javascript">        $(function(){            if(<?php (strpos($_server['request_uri'],'/web/login/index/1') === 0)?>) {               var loggedout= <?=$fb_logout;?>;             }            else{              var loggedout = null;               }          more java script         .         .         .           .         </script>   

what trying initialise loggedout value 1 stored in fb_logout if request comes page having /web/login/index/1 part of url. getting error in browsers console saying "syntax error" pointing after "if()" closing parantheses saying "jquery.min.js (line 3, col 15)" . using jquery library.

thanks

you need return/display result of statement:

<?=((strpos($_server['request_uri'],'/web/login/index/1') === 0) ? 'true': 'false')?> 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -