php - Jquery .clone() causing $.post to fail -
i copied html using .clone(true, true) because want keep jquery event handlers. when pass php via $.post post fails , gives me following error in firebug
uncaught exception: [exception... "could not convert javascript argument" nsresult: "0x80570009 (ns_error_xpc_bad_convert_js)" location: "js frame :: jquery-1.7.2.js :: <top_level> :: line 7740" data: no] i want somehow keep html , jquery event handlers because working on writing script save state user in.
update (added code)
//save html w/ jquery gsavestate = new object(); gsavestate['html'] = $('#content').clone(true, true); $.post("decopostate.php", { savedstate: gsavestate}, function(data){ alert("test"); } );
the problem code try send dom element - cannot obvious reasons. assuming want send html code of element, use $('#content').html()
var gsavestate = { html: $('#content').html(); }; however, event handlers not contained in string since attached element , not inline event (i.e. aren't attributes appear in dom tree).
to save application's state event handlers should not important @ though. use variables state information want save , include them in post data.
Comments
Post a Comment