SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member BungeeBones's Avatar
    Join Date
    Jan 2008
    0 Post(s)
    0 Thread(s)

    do I need ajax or just javascript?

    I have a php web page that, after displaying all its data, displays a link to even more data (if there is indeed data in the value). In other words, I have it query the db and if there is a result then show the link.

    The link, right now, simply reloads the same page but also shows the second section of data.

    I want the second section of data to be able to display after clicking the link but without reloading the entire page again. Is that best done with AJAX or just plain ole' javascript?

    The second section of data is currently gotten with a php funtion if the link has been clicked. I think it would be just as economical to query the data on the first page load so if I did do that, then I would have a php variable holding all the data in a manner ready to display.

    So what I need then is some type of on click action that will display the contents of that php variable without loading the entire page.

    Is that something javascript alone can do? Or is that actually AJAX? or both?

    I'm a total newbie in javascript but have played with AJAX a few times from premade scripts.
    - A New Paradigm of Website Promotion

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    West Springfield, Massachusetts
    198 Post(s)
    3 Thread(s)

    javascript - how?

    Both methods use javascript. I guess it depends on how much data there is. If it is a lot, then it might be better to have AJAX make another HTTP request to get the info and update the page. If not, then you could get the info on initial page load. AFAIK, both updating the page content, and changing what content is there would be fairly similar visual effect-wise. eg. changing display:hidden to diplay:block, or createNode insertNode.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts