Developing a FireFox toolbar (Javascript) to access MySQL?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Josh1billion
Forum Contributor
Posts: 316
Joined: Tue Sep 11, 2007 3:25 pm

Developing a FireFox toolbar (Javascript) to access MySQL?

Post by Josh1billion »

I was reading this article which is a tutorial on developing Firefox toolbars. It appears to use Javascript for the main code. Now I don't know much about Javascript at all, I've barely ever used it.

Is it possible to create a toolbar that would pass a username/password (of the user who is using the toolbar), and look up that user in the "users" table, make sure the password is correct, and then return a certain value "unread_message_count" to the toolbar? So that I could have a toolbar which shows a user's number of unread inbox messages.

Would this be possible, and if so, would it be easy to implement? How might I go about getting started on this?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

Sure it could be done. Try doing it just in Javascript first, then move it into an extension after it works.
User avatar
Josh1billion
Forum Contributor
Posts: 316
Joined: Tue Sep 11, 2007 3:25 pm

Post by Josh1billion »

I see. Do you have any pointers on which functions to use for Javascript access of MySQL? I think this would require Ajax but I'm not sure- and honestly I hardly know what Ajax is. :P

edit:
A quick google for ajax mysql and I found this page: http://www.tizag.com/ajaxTutorial/ajax- ... tabase.php
Is this leading me in the right direction? By the sound of it, I would be using the red-fonted code found in that code snippet to get the information.. passing the username and password (that the user entered into the toolbar) into the ajax-example.php file as a query string.

Am I on the right track here?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

A good friend of mine is working on Jester (actually, he's giving a talk at The Ajax Experience in Boston this week).

I just found out what it was it the other day but it looks downright wicked, and, possibly what you're looking for.
User avatar
Josh1billion
Forum Contributor
Posts: 316
Joined: Tue Sep 11, 2007 3:25 pm

Post by Josh1billion »

Jester sounds interesting, but I don't quite understand what it is.. a Javascript implementation of Rails's "REST protocol", but I've never worked with Rails so what is this REST protocol? I checked Wikipedia's article on the protocol and it doesn't say anything about MySQL.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

A data model represents a row in a table, as well as that row's relationships to other rows, as an object.

REST is a way of giving HTTP access to those models in a predictable way.

Jester is a Javascript tool to give you local (javascript) access to a remote data model that's represented in a RESTful way.

It's essentially the closest thing to having database access / ActiveResource directly in Javascript without a local DB server.

I fully encourage you to learn each of the above techniques as they're incredibly empowering in their own rights, and even more useful together!
Last edited by Kieran Huggins on Tue Oct 23, 2007 9:29 pm, edited 1 time in total.
User avatar
Josh1billion
Forum Contributor
Posts: 316
Joined: Tue Sep 11, 2007 3:25 pm

Post by Josh1billion »

Hmm sounds a little complicated.. maybe that tutorial I linked earlier might be the best/easiest way to go.
Post Reply