PDA

View Full Version : prototype Ajax not working



jamiejelly
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(
url,
{ 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?

thanks

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

jamiejelly
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?!

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

jamiejelly
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!

tian8970
Aug 16th, 2006, 12:34 PM
sorry,my english badly.
please view the source code of this url:http://210.75.112.240:9999/objjs/ajax1.html

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