/    Sign up×
Community /Pin to ProfileBookmark

Bulk processing help!

I have code which converts php file into xml file and displays like this below.

<?xml version=”1.0″ encoding=”UTF-8″ ?>
– <root>
– <row>
<url>lg.com</url>
<status>0</status>
</row>
– <row>
<url>youtube.com</url>
<status>0</status>
</row>
– <row>
<url>yahoo.com</url>
<status>0</status>
</row>
</root>

Now i have to read data from this xml file and store them in database one by one using javascript…exact process like this click on the link…[url]http://www.privateservers.org/status.png[/url].after storing in the db the status should change into ‘1-OK’,while processing i shoul be ‘2-Processing’ while waiting it shoul be ‘0-waiting’
i have a javascript but it is not working ….
please any one help

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@MrNobodyJan 30.2009 — So show some code and point out the lines that aren't working.
Copy linkTweet thisAlerts:
@sweetdragonsauthorJan 31.2009 — these r the javascripts that i have
[CODE]
var requestEle;
function getPage(url){

if(requestEle != null){ // stop pending requests if it's not loaded.
if( requestEle.abort ){
requestEle.abort();
}
requestEle = null;
}

if (window.XMLHttpRequest){// make a new request object
requestEle = new XMLHttpRequest();
}else
if (window.ActiveXObject){
requestEle = new ActiveXObject("Microsoft.XMLHTTP");
}

if( requestEle == null)// if we can't make an object abort
return null;

requestEle.open("GET",url,false);// load page
requestEle.send(null);

if( requestEle.status != 200){// if the page returned an error
return null;
}else{// otherwise return the XML
return requestEle.responseXML;
}
}

function checkStatus(){
var xml = getPage('status.php');
if(xml == null)
return;// error

// get two arrays.
var statuses = xml.documentElement.getElementsByTagName('status');
var rows = document.getElementById('tbl').getElementsByTagName('tr');

for(var i = statuses.length-1; i >= 0; i--){// load data
rows[i].getElementsByTagName('td')[1].innerHTML = (statuses[i].firstChild.nodeValue);
}
}
[/CODE]
Copy linkTweet thisAlerts:
@MrNobodyJan 31.2009 — Are you going to point out the problems?
Copy linkTweet thisAlerts:
@voidvectorFeb 01.2009 — The AJAX request is not constructed correctly, you cannot immediately test for "requestEle.status" after "requestEle.send(null)". A server request takes time, so you need to hook an event handler at "requestEle.onreadystatechange", the event handler would be a callback that starts whatever you need to do after receiving data.
Copy linkTweet thisAlerts:
@MrNobodyFeb 01.2009 — The AJAX request is not constructed correctly, you cannot immediately test for "requestEle.status" after "requestEle.send(null)". A server request takes time ...[/QUOTE]
That is not true in this case. If the third argument to the [B]open()[/B] method had been omitted or specified as [B]true[/B], then you would be correct. But by specifying [B]false[/B], the [B]send()[/B] method does not return control until the server has completed responding. You see, the third parameter to the [B]open()[/B] method determines whether the [B]send[/B] is [I][U]synchronous[/U][/I] or [I][U]asynchronous[/U][/I].
Copy linkTweet thisAlerts:
@voidvectorFeb 01.2009 — That is not true in this case. If the third argument to the [B]open()[/B] method had been omitted or specified as [B]true[/B], then you would be correct. But by specifying [B]false[/B], the [B]send()[/B] method does not return control until the server has completed responding. You see, the third parameter to the [B]open()[/B] method determines whether the [B]send[/B] is [I][U]synchronous[/U][/I] or [I][U]asynchronous[/U][/I].[/QUOTE]

I stand corrected.
Copy linkTweet thisAlerts:
@sweetdragonsauthorFeb 02.2009 — Thank u for your support i'l check it and verify
Copy linkTweet thisAlerts:
@sweetdragonsauthorFeb 02.2009 — can any one help me with some examples of this bulk processing?
Copy linkTweet thisAlerts:
@MrNobodyFeb 02.2009 — Tell you what... What you really need to do is to step through this with a script debugger. What browser are you testing with? Firefox has a nice debugger you can add on which is called Firebug. MS has a debugger for IE, but it is not free unless you have one of their development tools.
×

Success!

Help @sweetdragons spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...