View Full Version : Basic Ajax Routine from Anchor does not work

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

----------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() {

// 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 :

// then we log that we are here !
logger('V 352', "View");

and that works just fine.

But further on i do :

<td>Cliquer cette image pour obtenir votre brochure en FRAN&Ccedil;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>

(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:


08-20-2008, 03:45 AM
Hmmm please post a link to the page on your site that contains the problematic script so we can check it out.

08-20-2008, 01:09 PM
sure, here it is :


In fact this is a site running in Joomla, so the presentation will be a bit wrong.
Do you want me to post the source of the page here ?


08-28-2008, 08:15 PM

is anybody reading these posts ?


09-09-2008, 08:41 PM

Anybody there ???
Yoohoo ................:confused::confused::confused::confused:

I don't get it, am i the only one having this problem ?


09-10-2008, 06:53 AM
You're not being ignored personally, it's just due to the volume of questions we get daily, I can only take on so many of them, and further limit myself to ones I have a quick solution for. When you originally posted your follow up, I took a look and couldn't identify the problem, hence I had to move on. About the only suggestion I have for you at this point is to try and call logger() within an anchor link without any conditions, and see if that works:

<td>Cliquer cette image pour obtenir votre brochure en FRAN&Ccedil;AIS -></td><td><A href="brochures/V 352/brochure_F.pdf" name="brochure" onclick="logger('V 352', 'Brochure'); return false"><IMG src="images/brochures.jpg" alt="brochure" align="left" border="0"></A>

If that works, you know the problem has something to do with your condition.