Javascript JQuery help ?

28th of June 2012 0

Javascript JQuery help ?

I’m following a tutorial for twitter like application.
In the tutorial no database is used but i want to use the database.
I fetched the titles from my messages table and I want to show the title of each post in the popup window.
At the time I’m getting the title of my first post only against each post in popup window.
Please guide me how to embed some php in javascript. I’m new to javascript.
( I’m pasting here only some of my code for the convenience if you can understand )

$ (document).ready(function(){

//when clicked show another div
$ (‘.separate’).click( function() {

var getID = $ (this).attr(‘id’).replace(‘id-’,”);

/// check if div is already open
var flag = $ (‘#flag’).val();

if(flag == 1) // hide it
{
$ (‘#content2′).animate( {
left: ’250px’,
},250);

// set flag to 0
$ (‘#flag’).val(0);
}
else // show it
{
$ (‘#content2′).show();
$ (‘#content2′).animate( {
left: ’650px’,
},250);

var divData = $ (‘#id-’+getID).html();
$ (‘#placer’).html(”);
$ (‘#placer’).html(divData);

// set flag to 1
$ (‘#flag’).val(1);
}
});

// hide div
$ (‘.header-div span’).click( function() {

$ (‘#content2′).animate( {
left: ’250px’,
},250);
});

/// top right menus
$ (“ul.subnav”).parent().append(““);

$ (“ul.topnav li span”).click(function() {

$ (this).parent().find(“ul.subnav”).slideDown(‘fast’).show();

$ (this).parent().hover(function() {
}, function(){
$ (this).parent().find(“ul.subnav”).slideUp(‘slow’);
});

}).hover(function() {
$ (this).addClass(“subhover”);
}, function(){//On Hover Out
$ (this).removeClass(“subhover”);
});

});

“.$ rows['title'].$ rows['id'].”

“;
}
?>

Close X

Best answer:

Answer by Chris B
you can use PHP inside the code:
ie:

This should work due to the fact that PHP is parsed prior to JavaScript being executed.

What do you think? Answer below!

Filed under § jquery animate — Tagged with , ,

Share it!

Was it good for you to?

Sponsors

Support for the site!

No sponsors at the moment.



Your opinion matters. Add it below.


Tip: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent comments

Recent

  • The most recently written posts
  • Ajax Jquery Servlet Java (2)
  • how create floating web forms? (0)
  • PHP MYSQL JQUERY AJAX (16)
  • Help with using JQuery and Lightbox2? (0)
  • Preview jQuery Animate Slider Plugin JavaScript (0)
  • How to use jQuery scrollup Plugin | RR Foundation Bangla Tutorials (0)
  • Use jQuery instead of Javascript? (2)
  • Fetch JSON Array Elements Using jQuery AJAX Method: getJSON (16)
  • CSS, JQuery - Cool Register Form Animation - Basic Designing [Part - 3/4] (2)
  • Jquery Diasshow Problem? (0)
  • Categories

    Tags

    Searches



    Copyright jqueryui.info since 2010. All rights reserved. Design and the Absolute Theme by Tommie Hansen.