Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post

    Ajax to extract a div from another page possible?

    Would it be possible to use Ajax and take a portion such as in a div from another page?

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Sure, as long as the other page is on the same domain.

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    It is possible to grab HTML information from other domains as well, but in this case you need a server-side application (written in php, asp...) which receives the AJAX request, sends it to another server, gets the response and sends it back to the AJAX object.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post
    Is there any tutorial related to this ( Ajax and php )? I asked this question in the php section but I think my post got deleted without me getting any further.

  • #5
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    I found myself a ready-made php application for that on doing a simply google (I wanted not to reinvent the wheel)... I can not give you the link towards right now, as I am home, not at the office, but gimme a PM to remind me, and I might point you to that. Fell free to google yourself for, but you must know the basis of php to work with...
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #6
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Quote Originally Posted by gilgalbiblewhee View Post
    I asked this question in the php section but I think my post got deleted without me getting any further.
    Actually you posted it here in the same forum, and it got deleted as an obvious dupe, seeing two threads right next to each other with the same subject and similar contents tends to make me do that.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #7
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post
    Quote Originally Posted by liorean View Post
    Actually you posted it here in the same forum, and it got deleted as an obvious dupe, seeing two threads right next to each other with the same subject and similar contents tends to make me do that.
    It wasn't intentional. I posted in the php section. I read the answer in my email. But when I clicked the link it wasn't there. But fortunately I had a tab already open. So I copied from that content and pasted it the the AJAX section.

  • #8
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Here's a link for the article and php applications:
    http://www.troywolf.com/articles/php/class_http/

    I tested and used that successfully, together with AJAX in one of my sites.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #9
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Kor View Post
    Here's a link for the article and php applications:
    http://www.troywolf.com/articles/php/class_http/

    I tested and used that successfully, together with AJAX in one of my sites.
    I finally got a chance to look at the script and I tested it. I have two pages:
    class_http.php
    example.php

    I pasted every other bits of codes mentioned in your link in the example page.

    But if I'm going to simply pick up, let's say the div tags from another page how would that be possible? Which scripts apply to that?
    Attached Files Attached Files
    Last edited by gilgalbiblewhee; 03-25-2008 at 02:57 AM.

  • #10
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Screen scraping is not very nice thing to do....You should get permission before taking someone else's content and causing extra load on their servers....

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #11
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post
    I want to use it from my own pages. I give myself the permission.

  • #12
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Quote Originally Posted by gilgalbiblewhee View Post
    I want to use it from my own pages. I give myself the permission.
    If it is from your own pages, than why don;t you build yourself a JSON servoce or a web service to get the info. There is no need to scrape a page when you own the code.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #13
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post
    Quote Originally Posted by A1ien51 View Post
    If it is from your own pages, than why don;t you build yourself a JSON servoce or a web service to get the info. There is no need to scrape a page when you own the code.

    Eric
    JSON? Is that what it's called? Ok I'll look into it. Thanks.

  • #14
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post
    Ok I looked into JSON. From what I've seen JSON isn't what I'm looking for. My intention of grabbing information from one source to the next is from my own domain is to populate them in a database. I have a 700 paged ebook converted to html. So I want to grab all the div tags automatically instead of me doing things manually. DO you understand what I'm saying?

  • #15
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    We do understand. It is possible, but... do you have "700 paged ebook" and no DataBase?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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