I would think that your function, is returning a qoute of some sort, which
is canceling out the qoute around .html, which is throwing off the
javascript errors.

this

'jQuery("#target").html("%s");' % ('<strong class="hi"> this is a strong
sentence that breaks the javascript</strong')

Notice the qoutes where it defines class=. Try  changing all double qoutes
to single qoutes, see if that fixes your problem.

I ran into this as well, and single qoutes in the html fixed my problem.

-Thadeus




On Sun, Oct 11, 2009 at 11:33 AM, weheh <[email protected]> wrote:

>
> Massimo, I tried all your callbacks and none of them can render
> get_page. I should have noted that get_page is the exact same function
> that I use to successfully render the sub-page initially when the user
> clicks on the link that takes them to this particular page.
>
> That said, the text portion of get_page is rendered correctly by the
> following callbacks:
>
>  return "jQuery('#target').html(%s);" % repr(text)
>  return "jQuery('#target').html(%s);" % sj.dumps(str(text))
> and this works, too, but ' is quoted \'
>  return "jQuery('#target').html('%s');" % sj.dumps(repr(text))
>
> I would never have thought to invoke sj.dumps to do the job of
> rendering the text. I'm curious why this should even work?
>
> get_page calls a function show_buttons() that generates the buttons on
> the page. These are rollover-type buttons with a sharethis button,
> which is javascript. Taking, the divide and conquer approach to
> debugging the problem, I also tried the following callbacks, with the
> results shown as comments below. None of the javascripts worked to
> render the buttons.
>
>  return "jQuery('#target').html(%s);" % show_buttons() #fails: error
> missing } in sharethis javascript
>  return "jQuery('#target').html(%s);" % repr(show_buttons()) #fails:
> nothing renders, error "missing = in XML attribute"
>  return "jQuery('#target').html(%s);" % sj.dumps(str(show_buttons()))
> #fails: only sharethis button renders, but sharethis function not
> defined when you click on the button. None of the css rollover buttons
> render. And rest of webpage is mysteriously cleared.
>  return "jQuery('#target').html(%s);" % sj.dumps(repr(show_buttons
> ())) #fails: Nothing renders, but target is cleared.
>  return "jQuery('#target').html('%s');" % sj.dumps(str(show_buttons
> ())) #fails: nothing renders, error: "missing ) after argument list"
>  return "jQuery('#target').html('%s');" % sj.dumps(repr(show_buttons
> ())) #fails: renders pair of double quotes "" in target div
>  return 'jQuery("#target").html("%s");' % sj.dumps(str(show_buttons
> ())) #fails: nothing renders, error: "missing ) after argument list"
>  return 'jQuery("#target").html("%s");' % sj.dumps(repr(show_buttons
> ())) #fails: nothing renders, error: "missing ) after argument list"
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to