Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Prototype Ajax.Request error - Function Expected Options

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm getting the above error and i'm not sure why.
Here is the code i'm calling. This is in a custom js file that is
attached after the prototype library.

the 1st alert runs fine, but then i get that error. Any ideas? This
AddVenueToFavorites is a servlet.
[ May 01, 2008: Message edited by: Ilya Elkind ]
 
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm, I don't see anything awry on first inspection. Are you getting this error before the request fires or after the response returns? Are you using Firebug in Firefox to debug? It's essential for debugging Ajax requests.
 
Joshua Elkino
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not using FF.

This is happening before the servlet is called. I first get the initial alert saying its about to do the ajax but it never gets to the servlet. I know this because i have a sysout statement as the first line of code in the doGet method that doesnt get displayed.

Therefore my thought is as follows and please correct me if i'm mistaken. I'm using a few 3rd party scripts. Is it possible that another script has a Ajax wrapper defined?



my code is in custom.js
 
Joshua Elkino
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
adding to my train of thought, is it possible to call a function of a script from another script? I wouldnt see why not, but who knows.
 
Bear Bibeault
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilya Elkind:
I'm not using FF.

Start. Regardless of whether Firefox support is on your radar or not, Firebug in Firefox is by far the best way to find out what is going on with your Ajax requests. FF also has other great plugins like TamperData.

Trying to debug Javascript in IE is like trying to cut diamonds wearing welder's gloves.
 
Bear Bibeault
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilya Elkind:
adding to my train of thought, is it possible to call a function of a script from another script? I wouldnt see why not, but who knows.



Yes. They are all loaded into the same context. Caveat: you can call anything inline until it has been defined.
 
Joshua Elkino
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok i took your advice and it worked like a charm. I dl'd FF and installed Tamper Data plugin. Found out the call to my servlet was the wrong path.
It was trying to call localhost:8080/AddVenueToFavorites.

Once i added my domain, then it worked.

I changed the line
new Ajax.Request('/AddVenueToFavorites',...
to
new Ajax.Request('/MYDOMAIN/AddVenueToFavorites',...
 
Bear Bibeault
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These tools are the bomb, aren't they?
[ May 02, 2008: Message edited by: Bear Bibeault ]
 
Joshua Elkino
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quite amazing.

I was actually holding off FF testing till i was ready for that phase but this will help for debugging.

Hope IE8 will have something equivilent.
 
Bear Bibeault
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilya Elkind:
Once i added my domain, then it worked.

Just a terminology correction in case it causes future confusion, that's not your "domain", it's the context path of the web application.
 
Bear Bibeault
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilya Elkind:
I was actually holding off FF testing till i was ready for that phase but this will help for debugging.

I find it's best to simultaneously develop for all browsers, relying on Firefox for the brunt of debugging of all but browser-specific issues.

Hope IE8 will have something equivilent.

My jQuery in Action co-author is very excited about the prospects of IE8, but I've been so disappointed with IE7 that I'm setting my expectations very low.
[ May 02, 2008: Message edited by: Bear Bibeault ]
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic