Thanks for the replies! :D

On Jun 1, 1:12 pm, Isaac Gonzalez <ier...@gmail.com> wrote:
> I personally would just use jQuery's .get() method. Then with your PHP  
> pages you can use xml, json, or html snippets. I tend to use html  
> snippets.
>
> i.e.
>
> HTML
> <a href="MyNewBadAssDynamicPage.php?id=1" id="BadAssPage1">View Bad  
> Ass Page</a>
> <div id="BadAssPageContent"></div>
>
> JAVASCRIPT -
> $('#BadAssPage1').click(function(){
>         var pagelink = $('#BadAssPage1').attr('href');
>         $.get(pagelink, function(data){
>          $('#BadAssPageContent').html(data);
>       });
>
> });
>
> PHP - MyNewBadAssDynamicPage.php
>
> <?php
> $id = $_GET['id']
> // load db stuff form $id
> ?>
> <div class="coolstuff"><?php echo $dbStuff; ?></div>
>
> When I was first learning jQuery one thing help me get use to the idea  
> of ajax is not to think of databases or dynamic data. jQuery really  
> could careless if it's loading a php, asp, js, or even html page. All  
> it needs is a valid link to load the data. Once the data is loaded it  
> then needs a function to decide what to do with the data. That's it.
>
> Coming from a PHP & Actionscript background I would say the hardest  
> part of learning jQuery was excepting it's simplicity.
>
> On Jun 1, 2009, at 12:37 PM, Mike C wrote:
>
>
>
> > So I'm going to be printing a list of items from a database, and with
> > each item there will be a link printed with it. Essentially, I want
> > something like <a href="link from database" id="link_1">Load</a>,
> > except I want the link to use ajax. So in my scripts.js file I'll have
> > something like $('#link_1').click( function() { $('#link_1').load
> > ("link from database")}); I want to get the link from database from
> > the PHP file that contains the initial link. How would I do this?

Reply via email to