divinedesigns1 Posted August 2, 2012 Share Posted August 2, 2012 hey i was wondering if it is possible to add php scripts within javascript codes say i want to add the name of a table in the db into the js that obtain the id in js to make the script work, can i do <?php echo $w3c['js']; ?> and in the html or php echo i placed give the id the js row name, would this work? it should work right? Link to comment Share on other sites More sharing options...
boen_robot Posted August 2, 2012 Share Posted August 2, 2012 If you use XMLHttpRequest (a.k.a. AJAX), it should. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted August 2, 2012 Author Share Posted August 2, 2012 If you use XMLHttpRequest (a.k.a. AJAX), it should.umm i dont know how to use ajax either Link to comment Share on other sites More sharing options...
boen_robot Posted August 2, 2012 Share Posted August 2, 2012 It seems like you're ready to learn it. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted August 2, 2012 Author Share Posted August 2, 2012 It seems like you're ready to learn it.lml meanie jk jk jk jk thanks boen Link to comment Share on other sites More sharing options...
justsomeguy Posted August 2, 2012 Share Posted August 2, 2012 You can use PHP to output Javascript code if that's what you're trying to do. Link to comment Share on other sites More sharing options...
brunogiubilei Posted August 3, 2012 Share Posted August 3, 2012 Cara da uma olhada nesse link, ele mostra como passar um array PHP para o javascript e depois devolve-lo para PHPhttp://ahaprogramando.wordpress.com/2008/11/29/passar-array-de-php-para-javascript-e-de-javascript-para-php/sobre como recuperar o banco de dados e usar no javascript tenta isso<?$sql = "SELECT codigo FROM tab_teste "; $res = mysql_query($sql);while ($row = mysql_fetch_array($res)) { $codigo[] = $row['codigo'];}$string_arr_conjunto = implode("|", $arr_conjuntos);?><script>var codigo = [<?php echo $codigo; ?>];var array_codigo = codigo.split("|");alert(array_codigo);</script> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now