/    Sign up×
Community /Pin to ProfileBookmark

xml request trying to get it to work

when I only do one request, I am alright, but when I try to do anything more then 3 consectitive requests it does not work

<html>
<head>

<script type=”text/javascript”>

var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject(“Msxml2.XMLHTTP”);
} catch (e) {
try {
xmlhttp = new ActiveXObject(“Microsoft.XMLHTTP”);
} catch (E) {
xmlhttp = false;
}
}
@end @*
/
if (!xmlhttp && typeof XMLHttpRequest!=’undefined’) {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}

function promos(promo)
{

links(“https://www.spgpromos.com/tripleplayQ306/promos/terms/” +promo+ “0.cfm”)
links(“https://www.spgpromos.com/quarterly/promos/terms/q306/” +promo+ “0.cfm”)
links(“https://www.spgpromos.com/quarterly/promos/terms/q306_prereg/” +promo+ “0.cfm”)
links(“https://www.lg0.net/starwood/promos/promos/terms/” +promo+ “0.html”)
links(“http://www.starwoodhotels.com/preferredguest/promotions/registration/landing_page.html?promoID=” +promo)

}

function links(url) {
xmlhttp.open(“HEAD”, url,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
window.open(url)
}
}
}
xmlhttp.send(null)

}

</script>
</head>

<body>

<form name=”flink”>
<input type=”text” name=”reqlink” size=”150″>
<button name=”test” onClick=”promos(document.flink.reqlink.value)”>test</button>
</form>

</body>
</html>

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@cgishackJan 04.2007 — I am not Ajax expert, but I use it.

I think maybe your request are not complete and you are confusing your code.

There are ways to send MANY request at once using an array of the XMLHTTPRequest Object.

Check this article out for assistance if you think I am on the right track.

http://www.drakware.com/?e=2

Drew
Copy linkTweet thisAlerts:
@A1ien51Jan 04.2007 — You are using a global variable, you will keep overwriting it. You need to learn about OO JavaScript or wait until the request comes back before firing the next one.

Eric
Copy linkTweet thisAlerts:
@domiereavronauthorJan 07.2007 — I see my problem now, cgi pretty much hit the nail on the head, but now I am just trying to implement and understand that array of requests
×

Success!

Help @domiereavron 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.11,
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,
)...