Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

well I need to get elements of an specific id from a HTML page to display on my page

HTML element

  • Please log in to reply
1 reply to this topic

#1 UbuntuX


    CC Regular

  • Just Joined
  • PipPipPip
  • 40 posts

Posted 18 March 2010 - 05:25 AM

well I need to get elements of an specific id from a HTML page to display on my page like

when I press button which was named Yahoo then Ajax need to pull elements from a HTML page and return but it should be like that

<p id='yahoo_id'>Yahoo</p>
<p id='google_id'>Google</p>
<p id='bing_id'>Bing</p>
<p id='ask_id'>Ask</p>

when I press Google button it should pull elements in google_id and return the string NOT all String
so How do I do that with Ajax , Javascript , and XHTML(I don't know XML or PHP so don't go too far)

Note: this HTML file on the server and it should be a separate file not the one that we browse
so don't tell me use getElementById('google_id') because it's not in this page

-Thanks :sleep: :closedeyes:

Edited by Jaan, 18 March 2010 - 06:52 AM.
Please use code tags when you are posting your codes!

  • 0

#2 Drew


    CC Regular

  • Just Joined
  • PipPipPip
  • 42 posts

Posted 02 June 2010 - 04:28 PM

You can still use that command, just do a request to the other page and pull back all elements with that ID. I have done similar with PHP, but I'm not an expert with JavaScript or AJAX, but I can give the ideas on how to do it with maybe some help in how to do it. I've posted the AJAX request on here before, so by finding that you could make a request to a page to include the Javascript/AJAX/PHP or whatever, and process the required variables and then print/echo out the required parts.

It all depends on what the server has and can do as well. If it doesn't have PHP, then can't use PHP, if it isn't Windows, then that's good. If it's Unix, not Linux, then that's good as well. If it's Linux, well, that's just a GUI ontop of Unix. but if it's Unix based then PHP is inherant, if it's Windows, then it isn't. Depending on what you want to do depends on what can be done to assist you.

"use getElementById('google_id')" :) Just tellling you what you told me not to tell you.. :) Me baaaad.

This finction is fine to use, as long as you do the AJAX request to the other page and THEN call the getElementById() AFTER you have printed the page code, then it should be fine. You will have the elements there to play with.
  • 0

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download