Jump to content

Probably basic AJAX/Javascipt problem


mellis95

Recommended Posts

I am trying to implement a OpenRico livegrid (I am not that great yet with AJAX OR Javascript, but trying to learn) I have been following a tutorial I found at : http://jerome.sadou.free.fr/grid//index.php .

 

I am having trouble getting the grid to actually work and, according to the javascript console in Chrome, it seems to be the following function that is not working.

function bodyOnLoad() {
var opts = { prefetchBuffer: true, onscroll : updateHeader,
              sortAscendImg: 'http://localhost/accounting/classes/rico21/images/sort_asc.gif',
              sortDescendImg: 'http://localhost/accounting/classes/rico21/images/sort_desc.gif'
           	   };
new Rico.LiveGrid ("data_grid",10, 15, "xml_maker.php", opts);
}

 

Chrome javascript console gives the following error:    "Uncaught TypeError: undefined is not a function" on this line:

    new Rico.LiveGrid ("data_grid",10, 15, "xml_maker.php", opts);

I am sure I am missing something simple here.

 

Thanks in advance for the help.

Matt

 

 

Link to comment
Share on other sites

It appears that the Rico object isn't being set. Do you have this in your code?

<script src="rico.js" type="text/javascript"></script>

If you do, is it included before or after your function is called? Are you sure you are pointing to rico.js properly?

Link to comment
Share on other sites

It appears that the Rico object isn't being set. Do you have this in your code?

<script src="rico.js" type="text/javascript"></script>

If you do, is it included before or after your function is called? Are you sure you are pointing to rico.js properly?

 

I have this:

<script src="./../classes/rico21/src/rico.js" type="text/javascript"></script>

immediately before the script with the bodyOnLoad function. I have triple checked the path and it should be correct.

Link to comment
Share on other sites

Well, just to verify it, view the page source. In Firefox or Chrome the file references, such as your "./../classes/rico21/src/rico.js" will be clickable links. Click on that link and that will confirm that you are, in fact, pointing to the correct location.

Link to comment
Share on other sites

Well, just to verify it, view the page source. In Firefox or Chrome the file references, such as your "./../classes/rico21/src/rico.js" will be clickable links. Click on that link and that will confirm that you are, in fact, pointing to the correct location.

 

I viewed source and clicked the link and it took me straight to rico.js, so the path is correct.

 

Thanks,

Matt

Link to comment
Share on other sites

OK. I went through xml_maker.php and did find a misspelled variable name in a sql statement, but fixing that did not fix my problem. However, on looking again a little closer in the javascript console, I found this:

/accounting/classes/rico21/src/rico.js:241
60: Pre-load messages:
9: include: ricoCommon.js
11: include: translations/ricoLocale_en.js
12: waitingFor: window ricoCommon.js
50: waitingFor: window
52: waitingFor: window
60: waitingFor: 
60: Processing callbacks

assumptions.php:43
Uncaught TypeError: undefined is not a function

Now I am wondering if there is a problem in rico.js??  I didn't pay attention to this earlier because it did have ERROR written big right next to it. It is display in the "log" window in chrome js console.  Is it helpful in troubleshooting this?

 

Thanks again for the help.

Matt

 

Link to comment
Share on other sites

I'm sorry, but I'm not sure at this point. I use Firefox to code in, and I've found the Firebug add-on to be incredibly handy. I don't know anything about the Chrome log window in the JS console, but I can tell you that Firebug will allow you to watch the AJAX calls as they happen, and view the response, as well as other things. You may want to try that.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.