2016-04-14 26 views
-1

私はタグの外側に* JavaScript *機能を表示したいと思います。show function to php

どのようにすればいいですか?

WORDPRESSでの私のコードのPHP:あなただけのJavaScript自体に機能を実行しないだろう、なぜ

function custom_shortcode3() { 
    $conecta3 = mysql_connect("localhost", "mcommerce", "kaishek") or print (mysql_error()); 
    mysql_select_db("mcommerc_whmcs", $conecta3) or print(mysql_error()); 
    function mysql_get_var3($query,$y=0){ 
      $res = mysql_query($query); 
      $row = mysql_fetch_array($res); 
      mysql_free_result($res); 
      $rec = $row[$y]; 
      return $rec; 

    } 
    ?> 
    <html> 
     <div id="show"></div> 

     <script type="text/javascript" src="jquery.js"></script> 

     <script type="text/javascript"> 

          function total() { 
       setInterval(function() { 
        $('#show').load('datatotaldeprodutos.php') 
       }, 1000); 
      }; 
     <? 
    echo "total();"; //WORK BUT NOT APPEAR IN WORDPRESS 
?> 
     </script> 
    </html> 
    <? 
    echo "total();"; //NOT WORKKK 
    echo "test"; //WORK, APPEAR IN WORDPRESS. i need the function appear 
    } 
add_shortcode('totaldeprodutos', 'custom_shortcode3'); 
+3

_ * outside * the tags_?どういう意味ですか ? – Rayon

+0

echo "total();";タグ