Checking element existance in foreign page
var arr=new Array();
//url from urls.txt having list of urls
setArrayObject(page_request.responseText);//function defined below
if (window.location.href.indexOf("http")==-1 || text.status==200)
so now if url is xyz.html, the i'm getting the content of that page through AJAX and loading it to a DIV element(x).....and then accessing the div elements "name","category" etc.,
but if urls point to heavy pages, it's slow process to do this work.
so I WANT TO CHECK WHETHER THOSE DIV ID's EXIST IN THAT PAGE OR NOT WITHOUT LOADING THEM and then GET THEIR VALUES IF EXISTS.
Any one please help out. Thanks in advance
You can't. The XMLHTTP request has to wait for all data transmission to end before calling the complete event. So you have to load all the data. You cannot simple call certain elements or partial data w/o server side code.
For example. You could call a PHP script that rips out all data to a certain node level and return the skeleton. Or you could do the whole process on the server side.
Thanks for the reply, can you please specify some example showing how to do that in php as you said and how to do it on serverside.
That would take some time. You should do some experiments yourself and post here when you find trouble. Its always good to do stuff since you can learn a lot sometimes.
You can start by using something like PHP's simplexml
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread