WebsiteBaker Support (2.8.x) > jQuery

Fill / Load data as per link

(1/2) > >>

vikaspa:
Dear All

I am New to JQUERY


I want to Load php data as per link in a DIV or Layer

example
<a href="abcd.php?id=<?php $rows['id'];?>">Link </a>

click on this link will display a web page with data wherein id in SQL will be equal to  $_REQUEST['id']

I want to show the very same data (that will be displayed on new web page) in a div or layer using JQUERY

How to pass the value ?
and
How to load data in DIV

Pls pls pls help

Thanks in advance

Ruud:
I would start looking at the jQuery documentation.
http://api.jquery.com/jQuery.ajax/

vikaspa:

Thanks a lot ..

 and appreciate your quick feedback

still confused

pls guide...

Found (in documentation)

$.ajax({
  url: "test.html",
  context: document.body
}).done(function() {
  $(this).addClass("done");
});

I am confused.. how do i insert/pass the php variable in JQUERY
and
how do i user  loading this in DIV ?


$.ajax({
  url: "abcd.php?id="+<?php $rows['id'];?>,
// this will be similar to <a href="abcd.php?id=<?php $rows['id'];?>">Link </a>

  context: document.#mydiv  // myydiv is Div in which i want to load data
// can i use
}).done(function() {
  $(#mydiv).load("abcd.php?id="+<?php $rows['id'];?>);
});

 

vikaspa:
I can use

$("#stage").click(function(event){
          $('#stage').load('photogallery.php?cid=36&&subcid=48');
      });
   });
but dont know how to pass variables instead of values 36 and 48 using JQUERY

vikaspa:
solved !!
my java script / JQUERY

<script language="javascript">
 $(document).ready(function(){
 $(".activityclass").click(function () {

    $('#mydiv').fadeIn(1000);
         var value = $(this).attr("rel");
        var prog='activity.php?id='+value;
    
        $('#mydiv').load(prog);
     
   
});


php code or html part
i am using rel part so as to avois click to open up the new page


 <?php
         $i=0;
         do { $i++;?>
                <td height=25>
           <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="6%"><img src="whitearrow.png" width="5" height="11"></td>
                      <td width="94%">&nbsp;<a  href="#" rel="<?php echo $rows['id'];?>" class="activityclass"><?php echo $rows['name'];?></a></td>
                     </tr>
                  
                   </table>
  </td>
                <?php if ($i >=2) {$i=0; echo "</tr><tr>";}?>
               
                <?php  } while ($rows = mysql_fetch_assoc($Result));?>

Navigation

[0] Message Index

[#] Next page

Go to full version