Class is not defined error with presto-connect.js

User offline. Last seen 43 weeks 1 day ago. Offline
Joined: 03/19/2009
Points: 20
Groups: None

I'm trying to do a simple invocation of a service published in Presto Mashup Server. When the javascript modules are loaded I get the exception:

Class is not defined presto-connect.js()() presto-connect.js (line 618) Presto.DataProxy = Class.create({

When I try to create the Presto connection I get the following exception: Object.extend is not a function" coming from line 148 of presto-connect.js.

I put the following in my HTML as instructed in the documentation.

<script language="javascript" src="http://localhost:8080/static/common/js/prototype-1.6.0.js"></script> <script language="JavaScript" src="http://localhost:8080/static/common/js/presto-utils.js"></script> <script language="JavaScript" src="http://localhost:8080/static/common/js/presto-connect.js"></script>

My Javascript looks like this:

function getData(wordRoot)
{
    try
    {
      var prestoUrl = "http://127.0.0.1:8080/presto";
      var connection = new Presto.Connection({prestoUrl: prestoUrl, username: 'xxx', password: 'xxx'});
    }
    catch (e)
    {
        console.error(e);
    }
    connection.request(
          { //request configuration
              sid: 'SpellSuggest',
              oid: 'getData',

              //input parameters
              params: {
                  "wordRoot":wordRoot,
                  "size":10
              }
          },
          { //callback
              onSuccess: function(response) {
                  console.log('response = ');
                  console.log(data.response);
                  alert('success');
              },
              onFailure: function(err) {
                  alert('failure = ' + err.message);
              },
              scope: this
          }
    );
    console.log("done");
 }

any ideas? Thanks!

0
Your rating: None
jeremy.pitten's picture
User offline. Last seen 4 days 22 hours ago. Offline
Joined: 09/22/2008
Points: 275
Groups: None

The errors show that the prototype library is not being loaded.

The url to prototype file is wrong, so it looks like the documentation needs an update.

The prototype library url should be:

http://localhost:8080/static/common/js/prototype/prototype-1.6.0.js