javascript - How to pass a variable in jAlert from a php file -


i having bad time trying implement translating files site of mine. deal translate whole site php contains name of language used (ex. en.php, es.php, pt.php...) , set variables files called user click diferente language names webpage. no problem until then.

these languages variables defined in these php file this...

on pt.php:

define('texto_69','gostaria de se identificar?'); 

on en.php:

define('texto_69','would identify yourself?'); 

and on every php language file...

the main problem having not have acess these variables in index.php file when editing script part, take look:

if($('input[name="agree"]').is(':checked')) {         //alert('checkbox checked!!');         return true;     } else {          jalert('para efetuar o cadastro você deve estar de acordo com os termos de uso e politica de privacidade','aviso');         return false;     }     return true; 

i want replace string 'para efetuar o cadastro você deve estar de acordo com os termos de uso e politica de privacidade' , string 'aviso' texts in defined variables (ex. texto_69) in languages files.

opening php inside javascript function jalert , echoing variable not return string.

thank much!

solved including double quotes ("") in variable declaration inside jalert...

before (wrong):

jalert(<?php echo texto_69; ?>) 

after (right!)

jalert("<?php echo texto_69; ?>") 

:)


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -