Jump to content
php.lv forumi

Ielikt bildes folderi viena mainigaja


Sephy

Recommended Posts

Uztaisīju to savu array php! Tagad man vajag ielikt to array javascripta, lai ta vertibas varetu izmantot javascript operacijas! Ka to dara?

 

<script>
   var 
       arr = [<?=json_encode($arr);?>];

 

Kaut kā tā :) (varbūt tās kantainās iekavas nevajag, neatceros)

Link to comment
Share on other sites

bet ja skripta un php fails ir atsevišķš? to ka viena faila ir gan skripts un php es jau zinaju ;/

 

p.s.

 

pareizi ir bez kantainam iekavam, ja nu kads cits to pasu izmanto ;)

Edited by Sephy
Link to comment
Share on other sites

bet ja skripta un php fails ir atsevišķš? to ka viena faila ir gan skripts un php es jau zinaju ;/

 

p.s.

 

pareizi ir bez kantainam iekavam, ja nu kads cits to pasu izmanto ;)

 

Nu tur kur tu iekļauj to skriptu, tur arī padod to mainīgo.

 

<script type="text/javascript>
var
   myArr = <?=json_encode;?>
</script>
<script src="my_script.js" type="text/javascript></script>

 

tad iekš my_script būs pieejams globālais myArr

Edited by briedis
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...