I'm trying to create a tagcloud for an application. When I click a tag from the tagcloud, the backgroud for the tag must be changed. Here a simple html code for a tag:
<a about="http://localhost/d456c6" href="http://localhost/d456c6" class="tagweight0 Resource">abda</a>
To change the background i'm using the following:
$('tagweight0').livequery('click', function(event) {
$(this).toggleClass("select");
return false;
});
The url whitout selected tags look like this:
http://localhost/exploretags/
and when i have selected tags, it must be something like (JSON format):
http://localhost/exploretags/?selectedTags={"0" : "uri0", "1" : "uri1" , "2" : "uri2"}
I can use $.post to load the page. My problem is, that i have no idea, how to generate the value of the selectedTags parameter. On a click on a tag must be added an element in selectedTag and on click again on the same tag must be deleted, for example
- Tagloud whitout selected tags
- Click on tag "abc", the url to load is http://localhost/exploretags/?selectedTags={"0" : "http://localhost/tags/abc"}
- Click on tag "def", the url to load is http://localhost/exploretags/?selectedTags={"0" : "http://localhost/tags/abc", "1" : "http://localhost/tags/def"}
- Click on tag "abc". the url to load is http://localhost/exploretags/?selectedTags={"0" : "http://localhost/tags/def"}
My idea was to write a help function, which get all uris for tags with changed background. But i dont know, how to build the part between {} for the selectedTags parameter.
Can someone give me an idea, how to make this? Is my approach correct?
Regards, Sirakov
PS. Sorry for the long post and for the bad english