Re: [jQuery] jQuery API discussion
Klaus Hartl wrote: Of course you still have know that you have to pass a function reference of some kind to click() and the like, but if you want to use an API you should get familiar with it by reading the documentation to a certain extend, be it a designer or a programmer. Fortunately jQuery has a pretty good documentation. In my opinion (as a programmer) the documentation is pretty good. But I can understand very well that a designer could have some problems getting into the language. I've been reading now the first two tutorials again and tried to look at them as a designer. I can imagine very well that a designer has some problems to understand them if already in one of the first sentences the expression ... we start adding events etc... appears. I guess a designer does not know what events are. The question is, should the 'beginner tutorials' cover only jQuery or JS in general as well? As I said the documentation is good enough for me and I say thank you to everyone who wrote something. But I can understand very well if people without good programming knowledge have problems getting into jQuery. -- Raffael ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Best way for storing user preferences?
Hi, I've seen searching lately for a good way of storing preferences which a jQuery script needs later on. The specific information the script needs is the starting state of a div element (either open or closed). The preferences are stored in a DB and sent from there somehow to the browser. The sent and storing part is now the part I am searching for. After searching around for a while I found several ideas/solutions. But none seems to be perfect for me. So I wanted to ask you what is the best way to do it: 1) Store the information in an invincible div at the end of the page. And then parse this div. E.g: div id=prefs var1: value1; var2: value2; /div 2) The js-script gets generated each time the page is called. And the corresponding vars are set in there. 3) Every time the page is loaded the js-script asks the server for a XML (or JSON) file with the preferences in there. 4) Write a XHTML DTD module in order to extend the div element with a state-attribute. E.g: div state=closed 5) More (and better) ideas? To say is that those pages are often reloaded. From my point of view 3) generates to much traffic on the net. 1) is just a hack and therefor not really a good solution. I have my jQuery scripts already in an external file. This way they can be cached by the browser and don't have to be sent every time. So I don't really like 2) either. Right now I would go with 4) unless someone has a better idea. Does anybody have a better solution? Raffael ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Best way for storing user preferences?
Thanks Gilles, Mark and Luke! I was thinking about the cookie as well. But the problem I see here that a cookie can have in the maximum the size of 4k. It's not that I would reach the limit now, but I don't want to run into strange problems as soon as the application get larger over time. From this point of view Mark's solutions is more flexible. And I can generate those hidden input fields when I generate the page as well. The idea with the classes can get a little bit messy since I already have IDs and classes on those divs. At least I see that nobody would go for my favorite option. So I can probably drop it. Raffael Webunity | Gilles van den Hoven wrote: Option 3, but save the data you got from the server in a cookie, which you destroy after 1 day or something like that. Each time the user changes the div, a new cookie is set and data is send back to the server. This saves you half in traffic and is the best solution if you ask me. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Only allow PDF File upload
Hi, I would like to create a simple file upload form. The whole thing should be something like described here: http://ch2.php.net/features.file-upload But I would like to restrict the upload to PDF files. Since I already have jQuery running for other purposes I was thinking about using it for this as well. (At least for the first stage to check the last three letters of the filename. If I am right it is not possible to check the MIME type before sending) My idea is to check the file-input field as soon as the name of the file is in there. I am not sure now if I can treat this file-input field like a text-input field or if I have to look for something special. If I have to treat is special can someone give me more information on how to do it? Thanks, Raffael ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/