Problems with rsh and jquery

169 views
Skip to first unread message

Alter

unread,
Jan 22, 2009, 5:00:34 PM1/22/09
to ReallySimpleHistory
Hi.
I'm trying to use RSH, but enters in conflict with some jquery
functions.
In example, when i use $.ajax() function, in firebug shows the
following:

name.replace is not a function
attr(["left", "display"], function(), function())jquery.js (line 1115)
step(undefined)jquery.js (line 3308)
t(undefined)jquery.js (line 3223)
(no name)()jquery.js (line 3235)
[Break on this error] name = name.replace(/-([a-z])/ig, function(all,
letter){

But the post returns correctly to the specified response function.
In other example, when i use $.attr() function, shows:

String contains an invalid character" code: "5
[Break on this error] undefined
this.listener has no properties
[Break on this error] this.listener.call(null, newHash, historyData);
rsh.js (line 399)

By the way, all the code works correctly before to implement RSH.

I'm initializing RSH in this way:
window.dhtmlHistory.create();

window.onload = function(){
dhtmlHistory.initialize();
dhtmlHistory.addListener(handleHistoryChange);
};
Is that right? What i'm doing wrong? Any suggest will be welcome.
Thanks in advice.

Mark Hahn

unread,
Jan 22, 2009, 6:42:59 PM1/22/09
to reallysim...@googlegroups.com
I am getting those kind of errors from firebug even though I haven't yet tried to install RSH.  I even get them from random websites.  I've had this problem ever since I switched to FireFox 3.

bdpath...@gmail.com

unread,
Jan 28, 2009, 1:50:49 PM1/28/09
to ReallySimpleHistory
@Alter:

Try disabling Firebug and seeing if this problem occurs. Firebug is
known to generate some spurious warnings on Ajax/JavaScript-heavy
sites. If you're getting the correct behavior in the browser, it may
be a Firebug thing. I would also consider checking console output in
Safari and/or Opera to see if you get similar problems.

Finally, if you're using jQuery you should probably add your
window.onload handler using jQuery's event handler utilities rather
than applying it directly to window.onload. That way you can be sure
you're not clobbing any other onload handlers defined elsewhere in
your code.

--Brian

On Jan 22, 5:42 pm, Mark Hahn <mhah...@gmail.com> wrote:
> I am getting those kind of errors from firebug even though I haven't yet
> tried to install RSH.  I even get them from random websites.  I've had this
> problem ever since I switched to FireFox 3.
>

Jugz

unread,
Mar 12, 2009, 5:44:42 PM3/12/09
to ReallySimpleHistory
You need to over ride the toJSONString & parseJSON methods from the
JSON lib that comes along with RSH in order to use it along with
JQuery. You can do it by specifying the toJSON & fromJSON options as
part of history object creation.

window.dhtmlHistory.create( {
debugMode : true,
toJSON: function(o) {
return $.toJSON(o);
}
, fromJSON: function(s) {
return $.parseJSON(s);
}
});


Also, you need to include the JSON plugin for JQuery for the above two
methods to work. You can find more details about at that plugin @ :
http://code.google.com/p/jquery-json/
--Jugz

keymaker

unread,
May 3, 2009, 7:54:23 PM5/3/09
to ReallySimpleHistory
Solution!
thanks
Reply all
Reply to author
Forward
0 new messages