# Having trouble with AJAX call

**URL:** <https://forum.kirupa.com/t/having-trouble-with-ajax-call/233796>\
**Category:** Uncategorized\
**Created:** [July 26, 2007, 11:49pm UTC](https://forum.kirupa.com/t/having-trouble-with-ajax-call/233796 "2007-07-26T23:49:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dewey](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@dewey](https://forum.kirupa.com/u/dewey)\
**Post date:** [July 26, 2007, 11:49pm UTC](https://forum.kirupa.com/t/having-trouble-with-ajax-call/233796/1 "2007-07-26T23:49:08Z")

</div>

Not sure if this should be in the Client or server side… but I’ll try here becuase I think it’s more of a JS issue.

I have a function that makes an AJAX call and I set up the filename as:

var LOGIN\_PREFIX = ‘login.php?’;

However, this is where I am getting lost. My directory structure is something like:

root dir

- index.php
- login.php  
\> js dir  
\> - functions.js

I include js/functions.js in my index.php, and now I want my functions.js to call login.php to do this AJAX work… however, if I leave my prefix as is, it doesn’t appear that the call is being made (nothing comes back at all).

I have tried  
var LOGIN\_PREFIX = ‘…/login.php?’;

but get no results…

Any ideas?

Thanks!

–d

EDIT:  
The error appears to be in my method I have

function addEvent(objObject, strEventName, fnHandler) {  
// DOM-compliant way to add an event listener  
if (objObject.addEventListener) {  
objObject.addEventListener(strEventName, fnHandler, false);  
}  
// IE/windows way to add an event listener  
else if (objObject.attachEvent) {  
objObject.attachEvent(‘on’ + strEventName, fnHandler);  
}  
}

and I call it in here

function setupLogin()  
{  
validate = document.getElementById(‘validate’);  
addEvent(validate, ‘click’, validateLogin);  
}

after

addEvent(window,‘load’,setupLogin);

So the problem appears to be in handling the click event… I am working on it now… so… forget my issue…
