Lobbezoo
08-18-2008, 08:19 PM
1) Script Title: Basic Ajax Routine Get and Post
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxroutine.js
3) Describe problem:
When I call the script directly from some script it works ok, when i call it from an anchor, it does not start.
I have the following :
----- code ----------
<script type="text/javascript" src="script/ajaxroutine.js">
/***********************************************
* Basic Ajax Routine- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
----------other code-------------
------------snip -------------------
<script language="JavaScript" type="text/JavaScript">
// a dummy callback to avoid bla bla ??? don't know if we have to do this ???
function processGetPost() {
a="2";
}
// now the function that uses ajax to run a php script on the server, no output back
function logger(Mandat, Action) { // we log the action for the users convenience
poststr = encodeURI("Action=" + Action + "&Mandat=" + Mandat + "&Source=propdtail&user=67" );
ajaxpack.getAjaxRequest("TBlogger.php", poststr, processGetPost, "txt");
// var srp = new Image();
// srcvar = encodeURI("TBlogger.php?Action=" + Action + "&Mandat= " + Mandat + "&Source=propdtail&user=67" );
// srp.src = srcvar;
// this was the 'old' method i used to do the same
}
---------------- and more functions .......
Then in the body part i do somewhere :
<script>
// then we log that we are here !
logger('V 352', "View");
</script>
and that works just fine.
But further on i do :
<td>Cliquer cette image pour obtenir votre brochure en FRANÇAIS -></td><td><A href="brochures/V 352/brochure_F.pdf" name="brochure" onclick="if((document.getElementById('holdCAP2').value.toLowerCase()!= document.getElementById('testtext2').value.toLowerCase()) || (document.getElementById('testtext2').value == '')){alert('C-est pas le bon code de sécurité');return false;}else{logger('V 352', 'Brochure');}"><IMG src="images/brochures.jpg" alt="brochure" align="left" border="0"></A>
</td>
(some of the text is generated by php)
And that does not work.
I checked with an alert, and the logger routine is called, but the TBlogger.php is not executed at all. No errors, no messages, it just does not work.
(the other javascript has to do with a check-image the user has to copy to avoid spam).
Now, this part also did not work with my old 'logger' routine (the reason why i tried it with your ajax script) also. So, I'm out of ideas.
Any help would rely be appreciated :confused:
Steven
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxroutine.js
3) Describe problem:
When I call the script directly from some script it works ok, when i call it from an anchor, it does not start.
I have the following :
----- code ----------
<script type="text/javascript" src="script/ajaxroutine.js">
/***********************************************
* Basic Ajax Routine- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
----------other code-------------
------------snip -------------------
<script language="JavaScript" type="text/JavaScript">
// a dummy callback to avoid bla bla ??? don't know if we have to do this ???
function processGetPost() {
a="2";
}
// now the function that uses ajax to run a php script on the server, no output back
function logger(Mandat, Action) { // we log the action for the users convenience
poststr = encodeURI("Action=" + Action + "&Mandat=" + Mandat + "&Source=propdtail&user=67" );
ajaxpack.getAjaxRequest("TBlogger.php", poststr, processGetPost, "txt");
// var srp = new Image();
// srcvar = encodeURI("TBlogger.php?Action=" + Action + "&Mandat= " + Mandat + "&Source=propdtail&user=67" );
// srp.src = srcvar;
// this was the 'old' method i used to do the same
}
---------------- and more functions .......
Then in the body part i do somewhere :
<script>
// then we log that we are here !
logger('V 352', "View");
</script>
and that works just fine.
But further on i do :
<td>Cliquer cette image pour obtenir votre brochure en FRANÇAIS -></td><td><A href="brochures/V 352/brochure_F.pdf" name="brochure" onclick="if((document.getElementById('holdCAP2').value.toLowerCase()!= document.getElementById('testtext2').value.toLowerCase()) || (document.getElementById('testtext2').value == '')){alert('C-est pas le bon code de sécurité');return false;}else{logger('V 352', 'Brochure');}"><IMG src="images/brochures.jpg" alt="brochure" align="left" border="0"></A>
</td>
(some of the text is generated by php)
And that does not work.
I checked with an alert, and the logger routine is called, but the TBlogger.php is not executed at all. No errors, no messages, it just does not work.
(the other javascript has to do with a check-image the user has to copy to avoid spam).
Now, this part also did not work with my old 'logger' routine (the reason why i tried it with your ajax script) also. So, I'm out of ideas.
Any help would rely be appreciated :confused:
Steven