Hello,
I'm using jQuery since a few days, switched totally from prototyp.js to
jQuery and there a now a few questions:
1) This is never working:
$(window).unload(function() {
$.get(url);
});
I simply don't get it to work. How to add an unload-event for
document/window?
2) I have a <div id="nr" class="example"></div>
The class is at startup invisible (display: none). Now this happens:
$('#nr').show('slow').load(url).
The problem: Only the first line of the loaded content (url) is
displayed, nothing more. If I give width and height and overflow:auto
for the div, no scrollbars are displayed! BUT: If I use only show()
(without 'slow'), the scrollbars are displayed
3) This is the biggest problem at the moment (for me): I developed an
AjaxChat, which reloads every few seconds an url with the newest
messages for the user. I like the idea, to put simple Javascript in this
delivered content, which is automaticalle evaluated. But jQuery does not
evaluate it correctly: Variables are not set, I cannot do something like
this $('id').append("your message: $message"); It's not working. One
month ago this topic was discussed on the list:
http://www.mail-archive.com/[email protected]/msg01312.html , but I
cannot find a solution so far.
I did this (borrowed from prototype.js), which is working for me:
$.post(url, function(text) {
if (!text)
return;
// Match all script-blocks
var matchAll = new
RegExp('(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', 'img');
var matchOne = new
RegExp('(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', 'im');
var res = text.match(matchAll);
// evaluate every script
for (var i = 0; i < res.length; ++i) {
var sc = res[i].match(matchOne);
eval(sc[1]);
}
});
Idependently from this problems I really like jQuery, very good work.
Greetings from Germany/Bremen
Hermann-Marcus
--
Hermann-Marcus Behrens
Mail: [EMAIL PROTECTED]
Telefon: 0421 - 16 80 800
Fax: 0421 - 16 80 80 80
citybeat.de
Zum Huchtinger Bahnhof 13
28259 Bremen
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/