0

I want to pass a variable to a php file using load. based on this post, I tried that :

$( document ).ready(function() {
    $("#div2").load('loadTable.php',{
        'videoId': <?php echo $video_id ?>
    } );
    $("#div3").load("multiTimeline.php?videoid="+videoId+"");
});

It works perfectly fine like that(EDIT) :

$( document ).ready(function() {
    $("#div2").load('loadTable.php'); 
});

In the debugger I can see that it doesn't even open the loadTable.php. Does anybody see what I'm doing wrong?

Thanks in advance for help.

6
  • I don't know if it is this but are you closing the $( document ).ready(function() { ? Because in your sample it insn't closed and the code is correct so if it isn't working it may be because of one simple detail Commented Oct 12, 2013 at 15:56
  • like that it works: $( document ).ready(function() { $("#div2").load('loadTable.php'); $("#div3").load("multiTimeline.php"); }); Commented Oct 12, 2013 at 17:03
  • So it was that the problem? Commented Oct 12, 2013 at 17:04
  • But that doesn't work: [code] $( document ).ready(function() { $("#div2").load('loadTable.php', { 'videoId': <?php echo $video_id ?> } ); $("#div3").load("multiTimeline.php?videoid="+videoId+""); }); [code] Commented Oct 12, 2013 at 17:05
  • where is $video_id being declared in the first example? Ass the php code to your question please Commented Oct 12, 2013 at 17:08

1 Answer 1

0

Just for the update: This task was solved here

I forgot to put this code ( ) in ''

It works like this:

$("#div2").load('loadTable.php', { 'videoId': '<?php echo $video_id ?>'  } );
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.