Jump to content
php.lv forumi
  • 0

jQuery un mana funkcija


reGative

Question

Tātad esmu izveidojis tādu funkciju, kas uzspiežot uz div elementa ar onclick="speeleet(manavideoid)" blakus parāda video. Bet man šī funkcija nestrādā.

Funkcija :

<script type='text/javascript'>
function speeleet(video_id){
$.get("pages/video.php", { video_id = ""+video_id+""} );
}
</script>

video.php :

<?php$video_id = $_GET['video_id'];$kverijs = mysql_query("SELECT * FROM video WHERE video_id='$video_id'");
$video=mysql_fetch_array($kverijs);?>
<div class='virsraksts'><?=$video['title']?></div>
<object width="550" height="340"><param name="movie" value="http://www.youtube.com/v/<?=$video['video_id']?>?version=3&hl=lv_LV&rel=0&autoplay=1"></param>
<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/<?=$video['video_id']?>?version=3&hl=lv_LV&rel=0&autoplay=1" type="application/x-shockwave-flash" width="550" height="340" allowscriptaccess="always" allowfullscreen="true"></embed></object>
<div class='info'><?=$video['about']?></div>

firebug konsolē rāda - Uncaught ReferenceError: speeleet is not defined

(anonymous function)/?id=orchestra:39

onclick

 

Kas par vainu manam kodam?

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

Tajā pašā manuālī tak ir rakstīts.

urlA string containing the URL to which the request is sent.

dataA map or string that is sent to the server with the request.

success(data, textStatus, jqXHR)A callback function that is executed if the request succeeds.

dataTypeThe type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).

Link to comment
Share on other sites

  • 0

Pop-up logā parādas errors. sapratu, ka kaut kas manā funkcijā nav pareizi.

<script type='text/javascript'>
function speeleet(id){
$.get("pages/video.php", { video_id: 'id'},
  function(data){
    alert("Data Loaded: " + data);
  });
}
</script>

netieku skaidrībā, visu ko ar tām pēdiņām izmēģināju.

Link to comment
Share on other sites

  • 0

Nevis

video_id: 'id'

 

Bet gan:

video_id: id

 

Preteeji manam ieprieksheejam ieteikumam (ieprieksheejaa topikaa) - iesaku saakt ar JS pamatiem nevis jQuery un tad turpinaat shito, jo tev ir probleemas ar JS sintaksi.

 

Iieprieksheejais topiks ir par to pashu teemu. IMO labaak buutu shos divus apvienot un tad var paarvietot uz JS sadalju... Ja kaads atradiis ieprieksheejo topiku, tad vinjsh taa arii netiks pie iznaakuma, jo tas bus shajaa...

Link to comment
Share on other sites

  • 0

Tiku galā. Tikai man vajag to nevis popupā, kā tas ir tagad, bet blakus div elementā ,kurā būtu tas jāielādē.

 

UPDATE: alert("Data Loaded: " + data); vietā ieliku $('div#video_speeleet').html(data); un tagad viss ir ok. Paldies Jums!

Edited by reGative
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
Answer this question...

×   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...