Checking element existance in foreign page
var arr=new Array();
var x=document.createElement("div");
x.setAttribute("id","content");
//url from urls.txt having list of urls
page_request=getContentAjax(url);//AJAX Code
setArrayObject(page_request.responseText);//function defined below
var setArrayObject=function(text){
if (window.location.href.indexOf("http")==-1 || text.status==200)
x.innerHTML=text.responseText;
document.body.appendChild(x);
var n=document.getElementById("name").innerHTML
var cat=document.getElementById("category").innerHTML
var lt=document.getElementById("age").innerHTML
var ln=document.getElementById("dob").innerHTML
var q=Obj.make(n,cat,lt,ln);
arr.push(q);
x.innerHTML=""
}
Present
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.,
Problem
but if urls point to heavy pages, it's slow process to do this work.
Expected Solution
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 :)