News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

Using ajax in SMF

Started by ninedoors, March 26, 2009, 05:32:45 PM

Previous topic - Next topic

ninedoors

I have made a custom page in SMF that display stats from my hockey league and I would like to have the table be sortable thru ajax.  I am wondering if there is a way to do this inside SMF because right now when I click the header in my test page I get the table returned as well as another header and footer, which all appears inside the tables div.

I kinda expected this to happen but was wondering if there is a way to turn of the above_template and below_templates in the template system for use with ajax.  I assume that I am not the only one who wants to use ajax inside SMF so hopefully this is an easy fix.

Here is the page where the table is that I would like to use ajax for,

Barrie Mens Hockey League Stats

I have the stats table inside the div that I want to refresh.

Thanks for the help.

Nick
A government big enough to give you everything you want is big enough to take everything you have!

SMF 2.0
BMHL custom theme

SMF community is a great bunch of people!

ninedoors

Am I going to have to create a new php script outside of SMF?

A government big enough to give you everything you want is big enough to take everything you have!

SMF 2.0
BMHL custom theme

SMF community is a great bunch of people!

SlammedDime

AJAX wouldn't be required... AJAX is only needed if you need to send or receive data from the server... which you don't need to do. 

You could use pure javascript to accomplish the task, but it is no easy feat, and would require some time to create a script to do it properly.  It would be much easier to create a php script to do it.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

ninedoors

SlammedDime,

I think you misunderstood my intentions.  I want to refresh the stats table without a complete page load.  Only to load the newly sorted data.  I have been using the prototype javascript framework on my site with the ajax.updater function.  It works well outside of SMF but because SMF has the template system I thought I would have to use a separtate php outside SMF.   I didn't know if there was a way that anyone has previous done this effectively.

Nick
A government big enough to give you everything you want is big enough to take everything you have!

SMF 2.0
BMHL custom theme

SMF community is a great bunch of people!

H

Hi ninedoors, do you require any further assistance with this?

The SMF quick edit features use AJAX, so you can take a look at that for an example of what SMF does
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Advertisement: