Usagi
10-11-2007, 06:28 AM
1) Script Title:
Basic Ajax Routine (get & post)
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ajaxroutine.htm
3) Describe problem:
When I try to call the functions more than one time only the last one called shows up
<script type="text/javascript">
//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function processGetPost(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ //if request of file completed
if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
if (myfiletype=="txt")
document.getElementById("my_contests").innerHTML = myajax.responseText;
}
}
}
//Step 3: Invoke the Ajax routine method to make the desired Ajax request.
ajaxpack.getAjaxRequest("/iframes/my_contests.php/<? echo $AAuthorID ?>", "", processGetPost, "txt")
</script>
<script type="text/javascript">
//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function processGetPost(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ //if request of file completed
if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
if (myfiletype=="txt")
document.getElementById("won_contests").innerHTML = myajax.responseText;
}
}
}
//Step 3: Invoke the Ajax routine method to make the desired Ajax request.
ajaxpack.getAjaxRequest("/iframes/won_contests.php/<? echo $AAuthorID ?>", "", processGetPost, "txt")
</script>
<script type="text/javascript">
//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function processGetPost(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ //if request of file completed
if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
if (myfiletype=="txt")
document.getElementById("favorite_of").innerHTML = myajax.responseText;
}
}
}
//Step 3: Invoke the Ajax routine method to make the desired Ajax request.
ajaxpack.getAjaxRequest("/iframes/favorites.php/<? echo $AAuthorID ?>/favorite_of", "", processGetPost, "txt")
</script>
<script type="text/javascript">
//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function processGetPost(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ //if request of file completed
if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
if (myfiletype=="txt")
document.getElementById("my_favorites").innerHTML = myajax.responseText;
}
}
}
//Step 3: Invoke the Ajax routine method to make the desired Ajax request.
ajaxpack.getAjaxRequest("/iframes/favorites.php/<? echo $AAuthorID ?>/my_favorites", "", processGetPost, "txt")
</script>
You can see the problem here:
http://testingsite.prose-n-poetry.com/author/1952
(near the middle of the page - "My Contests, My Awards, Favorite of, My Favorites")
Is there any way to fix this?
Thanks in advance,
Usagi
Basic Ajax Routine (get & post)
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ajaxroutine.htm
3) Describe problem:
When I try to call the functions more than one time only the last one called shows up
<script type="text/javascript">
//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function processGetPost(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ //if request of file completed
if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
if (myfiletype=="txt")
document.getElementById("my_contests").innerHTML = myajax.responseText;
}
}
}
//Step 3: Invoke the Ajax routine method to make the desired Ajax request.
ajaxpack.getAjaxRequest("/iframes/my_contests.php/<? echo $AAuthorID ?>", "", processGetPost, "txt")
</script>
<script type="text/javascript">
//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function processGetPost(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ //if request of file completed
if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
if (myfiletype=="txt")
document.getElementById("won_contests").innerHTML = myajax.responseText;
}
}
}
//Step 3: Invoke the Ajax routine method to make the desired Ajax request.
ajaxpack.getAjaxRequest("/iframes/won_contests.php/<? echo $AAuthorID ?>", "", processGetPost, "txt")
</script>
<script type="text/javascript">
//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function processGetPost(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ //if request of file completed
if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
if (myfiletype=="txt")
document.getElementById("favorite_of").innerHTML = myajax.responseText;
}
}
}
//Step 3: Invoke the Ajax routine method to make the desired Ajax request.
ajaxpack.getAjaxRequest("/iframes/favorites.php/<? echo $AAuthorID ?>/favorite_of", "", processGetPost, "txt")
</script>
<script type="text/javascript">
//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function processGetPost(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ //if request of file completed
if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
if (myfiletype=="txt")
document.getElementById("my_favorites").innerHTML = myajax.responseText;
}
}
}
//Step 3: Invoke the Ajax routine method to make the desired Ajax request.
ajaxpack.getAjaxRequest("/iframes/favorites.php/<? echo $AAuthorID ?>/my_favorites", "", processGetPost, "txt")
</script>
You can see the problem here:
http://testingsite.prose-n-poetry.com/author/1952
(near the middle of the page - "My Contests, My Awards, Favorite of, My Favorites")
Is there any way to fix this?
Thanks in advance,
Usagi