View Full Version : prototype Ajax not working

Aug 16th, 2006, 09:33 AM
Hi, my first post here, so hi everyone.

I am trying to use prototype Ajax, but can't get it to work. Here is my code:

var dC = {
addEvent: function() {...},
init: function() {...},

doLookup: function() {
var url = 'http://path/to/script.php';
var pars = 'search=' + dC.search.value;

var myAjax = new Ajax.Request(
{ method: 'get',
parameters: pars,
onComplete: dC.handleLookup }); },

handleLookup: function(str) { alert(str); }, }

Obviously taken out lots of it... it executes fine up to the Ajax request but nothing happens with that piece of code. No Ajax request is fired off and I can't work out why.

Can anyone tell me what I'm doing wrong?


Aug 16th, 2006, 12:10 PM
handleLookup: function(str) { alert(str); }, }
handleLookup: function(str) { alert(str.responseText); }, }

Aug 16th, 2006, 12:13 PM
hi, thanks for your response, but that didn't work. handleLookup doesnt even get called!

prototype is definitely included, the path to script is definitely right... what else could it be?!

Aug 16th, 2006, 12:15 PM
handleLookup: function(str) { alert(str.responseText); }, }=>
handleLookup: function(str) { alert(str.responseText); }}
delete ","

Aug 16th, 2006, 12:18 PM
thanks but that still didn't work.

I am using FF with Firebug so I can see when XMLHttpRequests are fired off, and none are!

Aug 16th, 2006, 12:34 PM
sorry,my english badly.
please view the source code of this url:

Aug 16th, 2006, 12:36 PM
I get an error with that site.